Skip to content

Commit 1a6def3

Browse files
yiyixuxuyiyixuxu
and
yiyixuxu
authored
fix post-processing (#2968)
Co-authored-by: yiyixuxu <yixu310@gmail,com>
1 parent 0c63c38 commit 1a6def3

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,14 +734,15 @@ def __call__(
734734
image = latents
735735
has_nsfw_concept = None
736736

737-
image = self.decode_latents(latents)
738-
739-
if self.safety_checker is not None:
740-
image, has_nsfw_concept = self.run_safety_checker(image, device, prompt_embeds.dtype)
741737
else:
742-
has_nsfw_concept = False
738+
image = self.decode_latents(latents)
739+
740+
if self.safety_checker is not None:
741+
image, has_nsfw_concept = self.run_safety_checker(image, device, prompt_embeds.dtype)
742+
else:
743+
has_nsfw_concept = False
743744

744-
image = self.image_processor.postprocess(image, output_type=output_type)
745+
image = self.image_processor.postprocess(image, output_type=output_type)
745746

746747
# Offload last model to CPU
747748
if hasattr(self, "final_offload_hook") and self.final_offload_hook is not None:

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -742,14 +742,15 @@ def __call__(
742742
image = latents
743743
has_nsfw_concept = None
744744

745-
image = self.decode_latents(latents)
746-
747-
if self.safety_checker is not None:
748-
image, has_nsfw_concept = self.run_safety_checker(image, device, prompt_embeds.dtype)
749745
else:
750-
has_nsfw_concept = False
746+
image = self.decode_latents(latents)
747+
748+
if self.safety_checker is not None:
749+
image, has_nsfw_concept = self.run_safety_checker(image, device, prompt_embeds.dtype)
750+
else:
751+
has_nsfw_concept = False
751752

752-
image = self.image_processor.postprocess(image, output_type=output_type)
753+
image = self.image_processor.postprocess(image, output_type=output_type)
753754

754755
# Offload last model to CPU
755756
if hasattr(self, "final_offload_hook") and self.final_offload_hook is not None:

0 commit comments

Comments
 (0)