Skip to content

Commit 0a4e447

Browse files
committed
fix image encoding
1 parent db54f9d commit 0a4e447

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/diffusers/pipelines/sana/pipeline_sana_sprint_img2img.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,14 @@ def prepare_latents(self,
627627
)
628628

629629
image = image.to(device=device, dtype=dtype)
630+
if isinstance(image, torch.Tensor):
631+
pass
632+
else:
633+
image = self.image_processor.preprocess(image, height=height, width=width)
634+
630635
if image.shape[1] != num_channels_latents:
631-
image_latents = self._encode_vae_image(image=image, generator=generator)
636+
image = self.vae.encode(image=image, generator=generator).latent
637+
image_latents = image * self.vae.config.scaling_factor
632638
else:
633639
image_latents = image
634640
if batch_size > image_latents.shape[0] and batch_size % image_latents.shape[0] == 0:

0 commit comments

Comments
 (0)