aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
authoralg-wiki <47810160+alg-wiki@users.noreply.github.com>2022-10-10 19:35:28 +0000
committerGitHub <noreply@github.com>2022-10-10 19:35:28 +0000
commitf0ab972f85b4a185e7ff74b6f325835f1135deff (patch)
tree1719b7d8019c44aa55d51432d708ce8c9ca325d3 /modules/devices.py
parentbc3e183b739913e7be91213a256f038b10eb71e9 (diff)
parent5da1ba0e91a81804dc911d34c9a2e6956a23199c (diff)
downloadstable-diffusion-webui-gfx803-f0ab972f85b4a185e7ff74b6f325835f1135deff.tar.gz
stable-diffusion-webui-gfx803-f0ab972f85b4a185e7ff74b6f325835f1135deff.tar.bz2
stable-diffusion-webui-gfx803-f0ab972f85b4a185e7ff74b6f325835f1135deff.zip
Merge branch 'master' into textual__inversion
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()