aboutsummaryrefslogtreecommitdiff
path: root/modules/sd_samplers_common.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-19 08:34:46 +0300
committerGitHub <noreply@github.com>2023-08-19 08:34:46 +0300
commit7056fdf2bee50e5952cc0bac2047e96de336a36a (patch)
tree07ec71919a6729bab72bf1bc0f78c3b8430cdf2d /modules/sd_samplers_common.py
parent3d81fd714b45147c97f7ddbf3f14edaf7bd5bce6 (diff)
parent3003b10e0ab84abb6298285e707b3618ceec51dc (diff)
Merge pull request #12630 from catboxanon/fix/nans-mk2
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.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/sd_samplers_common.py b/modules/sd_samplers_common.py
index f0bc8e6a..feb1a9db 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