huggingface / huggingface/diffusers

bug while using cogvideox image to video pipeline

Offen
#11,133 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
bug stale
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Describe the bug

while using the script at "https://huggingface.co/docs/diffusers/using-diffusers/text-img2vid" of cogvideox pipeline,an error occured:
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 16 but got size 8 for tensor number 1 in the list.

### Reproduction

import torch
from diffusers import CogVideoXImageToVideoPipeline
from diffusers.utils import export_to_video, load_image

prompt = "A vast, shimmering ocean flows gracefully under a twilight sky, its waves undulating in a mesmerizing dance of blues and greens. The surface glints with the last rays of the setting sun, casting golden highlights that ripple across the water. Seagulls soar above, their cries blending with the gentle roar of the waves. The horizon stretches infinitely, where the ocean meets the sky in a seamless blend of hues. Close-ups reveal the intricate patterns of the waves, capturing the fluidity and dynamic beauty of the sea in motion."
image = load_image(image="cogvideox_rocket.png")
pipe = CogVideoXImageToVideoPipeline.from_pretrained(
"THUDM/CogVideoX-5b-I2V",
torch_dtype=torch.bfloat16
)

pipe.vae.enable_tiling()
pipe.vae.enable_slicing()

video = pipe(
prompt=prompt,
image=image,
num_videos_per_prompt=1,
num_inference_steps=50,
num_frames=49,
guidance_scale=6,
generator=torch.Generator(device="cuda").manual_seed(42),
).frames[0]

export_to_video(video, "output.mp4", fps=8)

### Logs

```shell
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████| 2/2 [00:01<00:00, 1.28it/s]
Loading pipeline components...: 100%|█████████████████████████████████████████████████████████████████████████████| 5/5 [00:03<00:00, 1.60it/s]
Traceback (most recent call last):
File "/home/qsy/snvd/demo/demo_generate_cogvideo.py", line 30, in
video = pipe(
^^^^^
File "/home/qsy/.conda/envs/snvds/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/qsy/snvd/model/pipeline_cogvideox_image2video.py", line 787, in __call__
latents, image_latents = self.prepare_latents(
^^^^^^^^^^^^^^^^^^^^^
File "/home/qsy/snvd/model/pipeline_cogvideox_image2video.py", line 407, in prepare_latents
image_latents = torch.cat([image_latents, latent_padding], dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 16 but got size 8 for tensor number 1 in the list.
```

### System Info

- 🤗 Diffusers version: 0.32.2
- Platform: Linux-5.15.0-113-generic-x86_64-with-glibc2.31
- Running on Google Colab?: No
- Python version: 3.11.11
- PyTorch version (GPU?): 2.5.1 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Huggingface_hub version: 0.29.1
- Transformers version: 4.49.0
- Accelerate version: 1.4.0
- PEFT version: 0.14.0
- Bitsandbytes version: not installed
- Safetensors version: 0.4.5
- xFormers version: not installed
- Accelerator: NVIDIA A800 80GB PCIe, 81920 MiB
NVIDIA A800 80GB PCIe, 81920 MiB
NVIDIA A800 80GB PCIe, 81920 MiB
NVIDIA A800 80GB PCIe, 81920 MiB
- Using GPU in script?:
- Using distributed or parallel set-up in script?:

### Who can help?

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere das Beispiel aus der verlinkten Diffusers-Dokumentation zu text-img2vid mit CogVideoXImageToVideoPipeline und der gemeldeten Umgebung. Beginne bei prepare_latents, wo der traceback zeigt, dass torch.cat beim Zusammenführen von image_latents und latent_padding fehlschlägt. Vergleiche ihre Tensorformen und überprüfe, dass die Pipeline abgeschlossen wird und output.mp4 ohne den Fehler wegen nicht übereinstimmender Größen exportiert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, pytorch
Bereich
machine-learning
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.