From a09c25c3fa2a8d9ffd490ef2db005545ebb37d4f Mon Sep 17 00:00:00 2001 From: townwish4git Date: Wed, 23 Oct 2024 14:35:46 +0800 Subject: [PATCH] fix(diffusers/pipelines): fix attr bugs in SDi2i pipeline --- .../stable_diffusion/pipeline_stable_diffusion_img2img.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mindone/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py b/mindone/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py index 5e818b0a83..c49f4418d1 100644 --- a/mindone/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +++ b/mindone/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py @@ -510,17 +510,15 @@ def encode_image(self, image, num_images_per_prompt, output_hidden_states=None): image = image.to(dtype=dtype) if output_hidden_states: - image_enc_hidden_states = self.image_encoder(image, output_hidden_states=True).hidden_states[-2] + image_enc_hidden_states = self.image_encoder(image, output_hidden_states=True)[2][-2] image_enc_hidden_states = image_enc_hidden_states.repeat_interleave(num_images_per_prompt, dim=0) - uncond_image_enc_hidden_states = self.image_encoder( - ops.zeros_like(image), output_hidden_states=True - ).hidden_states[-2] + uncond_image_enc_hidden_states = self.image_encoder(ops.zeros_like(image), output_hidden_states=True)[2][-2] uncond_image_enc_hidden_states = uncond_image_enc_hidden_states.repeat_interleave( num_images_per_prompt, dim=0 ) return image_enc_hidden_states, uncond_image_enc_hidden_states else: - image_embeds = self.image_encoder(image).image_embeds + image_embeds = self.image_encoder(image)[0] image_embeds = image_embeds.repeat_interleave(num_images_per_prompt, dim=0) uncond_image_embeds = ops.zeros_like(image_embeds)