Modular device management

This commit is contained in:
Abdullah Barhoum
2022-09-11 07:11:27 +02:00
committed by AUTOMATIC1111
parent 065e310a3f
commit b5d1af11b7
4 changed files with 19 additions and 13 deletions

View File

@@ -9,12 +9,13 @@ from PIL import Image
import modules.esrgam_model_arch as arch
from modules import shared
from modules.shared import opts
from modules.devices import has_mps
import modules.images
def load_model(filename):
# this code is adapted from https://github.com/xinntao/ESRGAN
pretrained_net = torch.load(filename, map_location='cpu' if torch.has_mps else None)
pretrained_net = torch.load(filename, map_location='cpu' if has_mps else None)
crt_model = arch.RRDBNet(3, 3, 64, 23, gc=32)
if 'conv_first.weight' in pretrained_net: