diff options
author | Dynamic <bradje@naver.com> | 2022-10-25 09:27:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 09:27:32 +0000 |
commit | 563fb0aa39faca32187e78c07bec695531f21f39 (patch) | |
tree | e8ba5b699b256ce90a07c52c52051e504f601659 /modules/devices.py | |
parent | e595b41c9d8a596b9b29d9505324e9afca2f12b5 (diff) | |
parent | 3e15f8e0f5cc87507f77546d92435670644dbd18 (diff) | |
download | stable-diffusion-webui-gfx803-563fb0aa39faca32187e78c07bec695531f21f39.tar.gz stable-diffusion-webui-gfx803-563fb0aa39faca32187e78c07bec695531f21f39.tar.bz2 stable-diffusion-webui-gfx803-563fb0aa39faca32187e78c07bec695531f21f39.zip |
Merge branch 'AUTOMATIC1111:master' into kr-localization
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) |