diff options
author | catboxanon <122327233+catboxanon@users.noreply.github.com> | 2023-08-17 22:10:55 +0000 |
---|---|---|
committer | catboxanon <122327233+catboxanon@users.noreply.github.com> | 2023-08-17 22:10:55 +0000 |
commit | 3003b10e0ab84abb6298285e707b3618ceec51dc (patch) | |
tree | ae50dc48963afe0570f94b225daa4bb051294ff3 /modules/sd_samplers_common.py | |
parent | 541ef9247cfe8785c12f7142ad02cd5310fc5925 (diff) | |
download | stable-diffusion-webui-gfx803-3003b10e0ab84abb6298285e707b3618ceec51dc.tar.gz stable-diffusion-webui-gfx803-3003b10e0ab84abb6298285e707b3618ceec51dc.tar.bz2 stable-diffusion-webui-gfx803-3003b10e0ab84abb6298285e707b3618ceec51dc.zip |
Attempt to resolve NaN issue with unstable VAEs in fp32 mk2
Diffstat (limited to 'modules/sd_samplers_common.py')
-rw-r--r-- | modules/sd_samplers_common.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/sd_samplers_common.py b/modules/sd_samplers_common.py index 7dc79ea8..67deefa5 100644 --- a/modules/sd_samplers_common.py +++ b/modules/sd_samplers_common.py @@ -49,7 +49,8 @@ def samples_to_images_tensor(sample, approximation=None, model=None): else:
if model is None:
model = shared.sd_model
- x_sample = model.decode_first_stage(sample.to(model.first_stage_model.dtype))
+ with devices.without_autocast(): # fixes an issue with unstable VAEs that are flaky even in fp32
+ x_sample = model.decode_first_stage(sample.to(model.first_stage_model.dtype))
return x_sample
|