aboutsummaryrefslogtreecommitdiffstats
path: root/modules/esrgan_model.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-08 07:31:20 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-09-08 07:31:20 +0000
commit61785cef656335cce3ab50b420301d2821f7c5e1 (patch)
treedf66e649b5e30c21fb68d6b93af9bb48b0f48584 /modules/esrgan_model.py
parent0fedd50886fb2f745cc6faab001090b77fbd0382 (diff)
parent9ddaf8269ebfb11c8fd2e48f0e8d33c125213437 (diff)
downloadstable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.tar.gz
stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.tar.bz2
stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'modules/esrgan_model.py')
-rw-r--r--modules/esrgan_model.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/esrgan_model.py b/modules/esrgan_model.py
index 3dcef5a6..2ed1d273 100644
--- a/modules/esrgan_model.py
+++ b/modules/esrgan_model.py
@@ -14,8 +14,11 @@ import modules.images
def load_model(filename):
# this code is adapted from https://github.com/xinntao/ESRGAN
-
- pretrained_net = torch.load(filename)
+ if torch.has_mps:
+ map_l = 'cpu'
+ else:
+ map_l = None
+ pretrained_net = torch.load(filename, map_location=map_l)
crt_model = arch.RRDBNet(3, 3, 64, 23, gc=32)
if 'conv_first.weight' in pretrained_net: