diff options
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 6 |
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) |