aboutsummaryrefslogtreecommitdiff
path: root/modules/devices.py
diff options
context:
space:
mode:
authorJC-Array <44535867+JC-Array@users.noreply.github.com>2022-10-10 18:11:02 -0500
committerGitHub <noreply@github.com>2022-10-10 18:11:02 -0500
commitd66bc86159d415005f0745fdb5724bcd95576352 (patch)
tree2544c33a8f443f226c9cf4bea7df7e3a30369812 /modules/devices.py
parent76ef3d75f61253516c024553335d9083d9660a8a (diff)
parent47f5e216da2af4b1faf232a620572f8b357855d5 (diff)
Merge pull request #2 from JC-Array/master
resolve merge conflicts
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()