aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-04 12:20:10 +0000
committerGitHub <noreply@github.com>2022-10-04 12:20:10 +0000
commitbc4d457de82f76f8ab9f2bedf933c06deb5d5ba9 (patch)
tree969e0e595bd36987ae9de9ae302085ef555bba15 /modules/devices.py
parentd5bba20a58f43a9f984bb67b4e17f48661f6b818 (diff)
parente9e2a7ec9ac704f133f586eb34176e388c93c87c (diff)
downloadstable-diffusion-webui-gfx803-bc4d457de82f76f8ab9f2bedf933c06deb5d5ba9.tar.gz
stable-diffusion-webui-gfx803-bc4d457de82f76f8ab9f2bedf933c06deb5d5ba9.tar.bz2
stable-diffusion-webui-gfx803-bc4d457de82f76f8ab9f2bedf933c06deb5d5ba9.zip
Merge pull request #1616 from brkirch/cpu-cmdline-opt
Add --use-cpu command line option
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/devices.py b/modules/devices.py
index 12aab665..0158b11f 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -2,9 +2,9 @@ import contextlib
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")
@@ -34,8 +34,7 @@ def enable_tf32():
errors.run(enable_tf32, "Enabling TF32")
-device = get_optimal_device()
-device_codeformer = cpu if has_mps else device
+device = device_gfpgan = device_bsrgan = device_esrgan = device_scunet = device_codeformer = get_optimal_device()
dtype = torch.float16
def randn(seed, shape):