aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
author不会画画的中医不是好程序员 <yfszzx@gmail.com>2022-10-25 07:38:33 +0000
committerGitHub <noreply@github.com>2022-10-25 07:38:33 +0000
commit5bfa2b23ca6dad7d2664bfab5dab4b1dfabf5b7f (patch)
tree7e23ff3f180ada71bc0824270efa82e7cfe68397 /modules/devices.py
parentff305acd51cc71c5eea8aee0f537a26a6d1ba2a1 (diff)
parent91c1e1e6a92061b99c92a5b1d548535907d2ad96 (diff)
downloadstable-diffusion-webui-gfx803-5bfa2b23ca6dad7d2664bfab5dab4b1dfabf5b7f.tar.gz
stable-diffusion-webui-gfx803-5bfa2b23ca6dad7d2664bfab5dab4b1dfabf5b7f.tar.bz2
stable-diffusion-webui-gfx803-5bfa2b23ca6dad7d2664bfab5dab4b1dfabf5b7f.zip
Merge branch 'AUTOMATIC1111:master' into Inspiron
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/devices.py b/modules/devices.py
index dc1f3cdd..7511e1dc 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -45,7 +45,7 @@ def enable_tf32():
errors.run(enable_tf32, "Enabling TF32")
-device = device_interrogate = device_gfpgan = device_bsrgan = device_esrgan = device_scunet = device_codeformer = None
+device = device_interrogate = device_gfpgan = device_swinir = device_esrgan = device_scunet = device_codeformer = None
dtype = torch.float16
dtype_vae = torch.float16
@@ -81,3 +81,7 @@ def autocast(disable=False):
return contextlib.nullcontext()
return torch.autocast("cuda")
+
+# MPS workaround for https://github.com/pytorch/pytorch/issues/79383
+def mps_contiguous(input_tensor, device): return input_tensor.contiguous() if device.type == 'mps' else input_tensor
+def mps_contiguous_to(input_tensor, device): return mps_contiguous(input_tensor, device).to(device)