diff options
author | DepFA <35278260+dfaker@users.noreply.github.com> | 2022-10-10 14:13:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 14:13:48 +0000 |
commit | ce2d7f7eaccbd1843835ca2d048d78ba5cb1ea13 (patch) | |
tree | 948c77a1ed9ed85278bc97ca02857b0c9efbd4b0 /modules/devices.py | |
parent | 4117afff11c7b0a2162c73ea02be8cfa30d02640 (diff) | |
parent | ce37fdd30e9fc0fe0bc5805a068ce8b11b42b5a3 (diff) | |
download | stable-diffusion-webui-gfx803-ce2d7f7eaccbd1843835ca2d048d78ba5cb1ea13.tar.gz stable-diffusion-webui-gfx803-ce2d7f7eaccbd1843835ca2d048d78ba5cb1ea13.tar.bz2 stable-diffusion-webui-gfx803-ce2d7f7eaccbd1843835ca2d048d78ba5cb1ea13.zip |
Merge branch 'master' into embed-embeddings-in-images
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 6 |
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() |