diff options
author | JC-Array <44535867+JC-Array@users.noreply.github.com> | 2022-10-10 23:06:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 23:06:07 +0000 |
commit | aca1553bde726e1455f3a73a6378b31e93d3e8f2 (patch) | |
tree | b5492fb630f58deddd9fbf812fdd7d9134a59cc1 /modules/devices.py | |
parent | 45fbd1c5fec887988ab555aac75a999d4f3aff40 (diff) | |
parent | 42bf5fa3256bff5e4640e5a626e750d4e49e01e1 (diff) | |
download | stable-diffusion-webui-gfx803-aca1553bde726e1455f3a73a6378b31e93d3e8f2.tar.gz stable-diffusion-webui-gfx803-aca1553bde726e1455f3a73a6378b31e93d3e8f2.tar.bz2 stable-diffusion-webui-gfx803-aca1553bde726e1455f3a73a6378b31e93d3e8f2.zip |
Merge pull request #1 from AUTOMATIC1111/master
updating files to resolve merge conflicts
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() |