aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-12 07:35:42 +0000
committerGitHub <noreply@github.com>2022-10-12 07:35:42 +0000
commitdc1432e0dd2b826bbf5aee3e87d8270c151e4912 (patch)
tree276c27910e8ec38a1a054df02c67f73a84cb35df /modules/devices.py
parent1d64976dbc5a0f3124567b91fadd5014a9d93c5f (diff)
parentca5efc316b9431746ff886d259275310f63f95fb (diff)
downloadstable-diffusion-webui-gfx803-dc1432e0dd2b826bbf5aee3e87d8270c151e4912.tar.gz
stable-diffusion-webui-gfx803-dc1432e0dd2b826bbf5aee3e87d8270c151e4912.tar.bz2
stable-diffusion-webui-gfx803-dc1432e0dd2b826bbf5aee3e87d8270c151e4912.zip
Merge branch 'master' into feature/scale_to
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/devices.py b/modules/devices.py
index 0158b11f..03ef58f1 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -36,6 +36,7 @@ errors.run(enable_tf32, "Enabling TF32")
device = device_gfpgan = device_bsrgan = device_esrgan = device_scunet = device_codeformer = get_optimal_device()
dtype = torch.float16
+dtype_vae = torch.float16
def randn(seed, shape):
# Pytorch currently doesn't handle setting randomness correctly when the metal backend is used.
@@ -59,9 +60,12 @@ def randn_without_seed(shape):
return torch.randn(shape, device=device)
-def autocast():
+def autocast(disable=False):
from modules import shared
+ if disable:
+ return contextlib.nullcontext()
+
if dtype == torch.float32 or shared.cmd_opts.precision == "full":
return contextlib.nullcontext()