ValueError: too many values to unpack (expected 3)

#50
by nripesh - opened

I'm using the exact same code given in model card by getting valueError
valueError.png

use this code after prompt
video_frames = pipe(prompt, num_inference_steps=25).frames

Convert frames to numpy arrays

video_frames_np = [np.array(frame) for frame in video_frames]

Concatenate the frames into a single array

video_frames_np = np.concatenate(video_frames_np, axis=0)

Pass the modified frames to export_to_video function

video_path = export_to_video(video_frames_np)

Traceback (most recent call last):
  File "/data/wqq/sino-llm-local-services/services/text2vi_services.py", line 33, in generate_video
    video_path = export_to_video(video_frames)
  File "/root/miniconda3/envs/llm-local-services/lib/python3.10/site-packages/diffusers/utils/export_utils.py", line 135, in export_to_video
    h, w, c = video_frames[0].shape
ValueError: too many values to unpack (expected 3)

use this code after prompt
video_frames = pipe(prompt, num_inference_steps=25).frames

Convert frames to numpy arrays

video_frames_np = [np.array(frame) for frame in video_frames]

Concatenate the frames into a single array

video_frames_np = np.concatenate(video_frames_np, axis=0)

Pass the modified frames to export_to_video function

video_path = export_to_video(video_frames_np)

maybe you should update this export_to_video, the input params Expected type 'list[ndarray] | list[Image]', got 'ndarray[Any, dtype[generic | generic | Any]]' instead
best wishes

I have used the following code and it works fine for me
import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import export_to_video
import numpy as np

pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
#@title Generate your video
prompt = "Incredibly detailed science fiction scene set on an alien planet, view of a marketplace. Pixel art." #@param {type:"string"}
video_frames = pipe(prompt, num_inference_steps=25).frames

Convert frames to numpy arrays

video_frames_np = [np.array(frame) for frame in video_frames]

Concatenate the frames into a single array

video_frames_np = np.concatenate(video_frames_np, axis=0)

Pass the modified frames to export_to_video function

video_path = export_to_video(video_frames_np)

video_path = export_to_video(video_frames[0])

Sign up or log in to comment