1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

[Pipeline] Fix error of SVD pipeline when num_videos_per_prompt > 1 (#7786)

swap the order for do_classifier_free_guidance concat with repeat

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
This commit is contained in:
Yushu
2024-04-29 03:54:16 -07:00
committed by GitHub
parent b1c5817a89
commit a38dd79512

View File

@@ -199,6 +199,9 @@ class StableVideoDiffusionPipeline(DiffusionPipeline):
image = image.to(device=device)
image_latents = self.vae.encode(image).latent_dist.mode()
# duplicate image_latents for each generation per prompt, using mps friendly method
image_latents = image_latents.repeat(num_videos_per_prompt, 1, 1, 1)
if do_classifier_free_guidance:
negative_image_latents = torch.zeros_like(image_latents)
@@ -207,9 +210,6 @@ class StableVideoDiffusionPipeline(DiffusionPipeline):
# to avoid doing two forward passes
image_latents = torch.cat([negative_image_latents, image_latents])
# duplicate image_latents for each generation per prompt, using mps friendly method
image_latents = image_latents.repeat(num_videos_per_prompt, 1, 1, 1)
return image_latents
def _get_add_time_ids(