Skip to content

Commit f674c48

Browse files
committed
bugfix: save image for hires fix BEFORE upscaling latent space
1 parent 321e13c commit f674c48

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/processing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,17 +665,17 @@ def save_intermediate(image, index):
665665
images.save_image(image, self.outpath_samples, "", seeds[index], prompts[index], opts.samples_format, suffix="-before-highres-fix")
666666

667667
if opts.use_scale_latent_for_hires_fix:
668+
for i in range(samples.shape[0]):
669+
save_intermediate(samples, i)
670+
668671
samples = torch.nn.functional.interpolate(samples, size=(self.height // opt_f, self.width // opt_f), mode="bilinear")
669-
672+
670673
# Avoid making the inpainting conditioning unless necessary as
671674
# this does need some extra compute to decode / encode the image again.
672675
if getattr(self, "inpainting_mask_weight", shared.opts.inpainting_mask_weight) < 1.0:
673676
image_conditioning = self.img2img_image_conditioning(decode_first_stage(self.sd_model, samples), samples)
674677
else:
675678
image_conditioning = self.txt2img_image_conditioning(samples)
676-
677-
for i in range(samples.shape[0]):
678-
save_intermediate(samples, i)
679679
else:
680680
decoded_samples = decode_first_stage(self.sd_model, samples)
681681
lowres_samples = torch.clamp((decoded_samples + 1.0) / 2.0, min=0.0, max=1.0)

0 commit comments

Comments
 (0)