diff options
author | yfszzx <yfszzx@gmail.com> | 2022-10-11 12:23:41 +0000 |
---|---|---|
committer | yfszzx <yfszzx@gmail.com> | 2022-10-11 12:23:41 +0000 |
commit | 594ab4ba53a80a0a3606565404e6d1fbb60f6629 (patch) | |
tree | 2821eef661e6568b65d8d29c268b657a17dcd423 /modules/devices.py | |
parent | 7b1db45e1fda8603d4617affd976066be5e5b821 (diff) | |
parent | dce7fc902ae2c6d9ffa71db67471abdcda72f82c (diff) | |
download | stable-diffusion-webui-gfx803-594ab4ba53a80a0a3606565404e6d1fbb60f6629.tar.gz stable-diffusion-webui-gfx803-594ab4ba53a80a0a3606565404e6d1fbb60f6629.tar.bz2 stable-diffusion-webui-gfx803-594ab4ba53a80a0a3606565404e6d1fbb60f6629.zip |
images history improvement
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() |