diff options
author | brkirch <brkirch@users.noreply.github.com> | 2022-10-04 08:24:35 +0000 |
---|---|---|
committer | brkirch <brkirch@users.noreply.github.com> | 2022-10-04 08:24:35 +0000 |
commit | eeab7aedf532680a6ae9058ee272450bb07e41eb (patch) | |
tree | b5434f872fefd7642cc322b63c7e0aa90c575ebd /modules/devices.py | |
parent | b88e4ea7d6536ddc814a9101a258f87b06230019 (diff) | |
download | stable-diffusion-webui-gfx803-eeab7aedf532680a6ae9058ee272450bb07e41eb.tar.gz stable-diffusion-webui-gfx803-eeab7aedf532680a6ae9058ee272450bb07e41eb.tar.bz2 stable-diffusion-webui-gfx803-eeab7aedf532680a6ae9058ee272450bb07e41eb.zip |
Add --use-cpu command line option
Remove MPS detection to use CPU for GFPGAN / CodeFormer and add a --use-cpu command line option.
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/devices.py b/modules/devices.py index 5d9c7a07..b5a0cd29 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -1,8 +1,8 @@ import torch -# has_mps is only available in nightly pytorch (for now), `getattr` for compatibility from modules import errors +# has_mps is only available in nightly pytorch (for now), `getattr` for compatibility has_mps = getattr(torch, 'has_mps', False) cpu = torch.device("cpu") @@ -32,8 +32,7 @@ def enable_tf32(): errors.run(enable_tf32, "Enabling TF32") -device = get_optimal_device() -device_gfpgan = device_codeformer = cpu if device.type == 'mps' else device +device = device_gfpgan = device_esrgan = device_scunet = device_codeformer = get_optimal_device() dtype = torch.float16 def randn(seed, shape): |