diff options
author | brkirch <brkirch@users.noreply.github.com> | 2023-01-24 23:51:45 -0500 |
---|---|---|
committer | brkirch <brkirch@users.noreply.github.com> | 2023-01-25 01:13:02 -0500 |
commit | 84d9ce30cb427759547bc7876ed80ab91787d175 (patch) | |
tree | a87ca1a7094ca9b7af4e573a211b1dcf8146af67 /modules/devices.py | |
parent | 48a15821de768fea76e66f26df83df3fddf18f4b (diff) |
Add option for float32 sampling with float16 UNet
This also handles type casting so that ROCm and MPS torch devices work correctly without --no-half. One cast is required for deepbooru in deepbooru_model.py, some explicit casting is required for img2img and inpainting. depth_model can't be converted to float16 or it won't work correctly on some systems (it's known to have issues on MPS) so in sd_models.py model.depth_model is removed for model.half().
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/devices.py b/modules/devices.py index 524ec7af..0981ef80 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -79,6 +79,8 @@ cpu = torch.device("cpu") device = device_interrogate = device_gfpgan = device_esrgan = device_codeformer = None dtype = torch.float16 dtype_vae = torch.float16 +dtype_unet = torch.float16 +unet_needs_upcast = False def randn(seed, shape): |