Skip to content

Commit

Permalink
fix(diffusers/pipelines): fix attr bugs in SDi2i pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
townwish4git committed Nov 11, 2024
1 parent 535d05e commit a09c25c
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit a09c25c

Please sign in to comment.