diff options
author | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2024-01-09 15:30:55 +0000 |
---|---|---|
committer | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2024-01-09 15:30:55 +0000 |
commit | ca671e5d7b9d03227f01e6bcb350032b6d14e722 (patch) | |
tree | 0e6cf7f344faed75b16150a4c4dfb66a9a9ec620 /modules | |
parent | 58d5b042cd02f287faabef399134b97d323691f2 (diff) | |
download | stable-diffusion-webui-gfx803-ca671e5d7b9d03227f01e6bcb350032b6d14e722.tar.gz stable-diffusion-webui-gfx803-ca671e5d7b9d03227f01e6bcb350032b6d14e722.tar.bz2 stable-diffusion-webui-gfx803-ca671e5d7b9d03227f01e6bcb350032b6d14e722.zip |
rearrange if-statements for cpu
Diffstat (limited to 'modules')
-rw-r--r-- | modules/devices.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/devices.py b/modules/devices.py index 29a270d1..0321d12c 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -185,15 +185,15 @@ def autocast(disable=False): if fp8 and device==cpu: return torch.autocast("cpu", dtype=torch.bfloat16, enabled=True) - if has_xpu() or has_mps() or cuda_no_autocast(): - return manual_cast(dtype) - if fp8 and dtype_inference == torch.float32: return manual_cast(dtype) if dtype == torch.float32 or dtype_inference == torch.float32: return contextlib.nullcontext() + if has_xpu() or has_mps() or cuda_no_autocast(): + return manual_cast(dtype) + return torch.autocast("cuda") |