Skip to content

Commit

Permalink
Merge pull request #12630 from catboxanon/fix/nans-mk2
Browse files Browse the repository at this point in the history
Attempt to resolve NaN issue with unstable VAEs in fp32 mk2
  • Loading branch information
AUTOMATIC1111 authored Aug 19, 2023
2 parents 3d81fd7 + 3003b10 commit 7056fdf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/sd_samplers_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7056fdf

Please sign in to comment.