Skip to content

Commit

Permalink
Attempt to resolve NaN issue with unstable VAEs in fp32 mk2
Browse files Browse the repository at this point in the history
  • Loading branch information
catboxanon committed Aug 17, 2023
1 parent 541ef92 commit 3003b10
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 3003b10

Please sign in to comment.