THUDM / CogVideo

text and image to video generation: CogVideoX (2024) and CogVideo (ICLR 2023)
Apache License 2.0
9.23k stars 865 forks source link

ValueError: Trying to set a tensor of shape torch.Size([3072, 128]) in "weight" (which has shape torch.Size([3072, 16, 2, 2])), this looks incorrect. #516

Open DennisFaucher opened 1 day ago

DennisFaucher commented 1 day ago

System Info / 系統信息

$ python -V Python 3.12.3

$ uname -a Linux nvidia-k8s 5.15.0-125-generic #135~20.04.1-Ubuntu SMP Mon Oct 7 13:56:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"

$ nvidia-smi NVIDIA-SMI 535.216.01 Driver Version: 535.216.01 CUDA Version: 12.2

CogVideo$ python inference/cli_demo.py --prompt "A girl riding a bike." --model_path THUDM/CogVideoX1.5-5b --generate_type "t2v"

Traceback (most recent call last): File "/home/dennis/Documents/Python/CogVideo/inference/cli_demo.py", line 179, in generate_video( File "/home/dennis/Documents/Python/CogVideo/inference/cli_demo.py", line 84, in generate_video pipe = CogVideoXPipeline.from_pretrained(model_path, torch_dtype=dtype) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(args, kwargs) ^^^^^^^^^^^^^^^^^^^ File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/diffusers/pipelines/pipeline_utils.py", line 896, in from_pretrained loaded_sub_model = load_sub_model( ^^^^^^^^^^^^^^^ File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 704, in load_sub_model loaded_sub_model = load_method(os.path.join(cached_folder, name), loading_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/diffusers/models/modeling_utils.py", line 886, in from_pretrained accelerate.load_checkpoint_and_dispatch( File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/accelerate/big_modeling.py", line 613, in load_checkpoint_and_dispatch load_checkpoint_in_model( File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/accelerate/utils/modeling.py", line 1780, in load_checkpoint_in_model set_module_tensor_to_device( File "/home/dennis/.pyenv/versions/pyenv_312/lib/python3.12/site-packages/accelerate/utils/modeling.py", line 286, in set_module_tensor_to_device raise ValueError( ValueError: Trying to set a tensor of shape torch.Size([3072, 128]) in "weight" (which has shape torch.Size([3072, 16, 2, 2])), this looks incorrect.

Information / 问题信息

Reproduction / 复现过程

$ python inference/cli_demo.py --prompt "A girl riding a bike." --model_path THUDM/CogVideoX1.5-5b --generate_type "t2v"

Expected behavior / 期待表现

Successful completion

randaller commented 1 day ago

Same here under Windows, diffusers built from RzRz cogvideox branch. image

nitinmukesh commented 1 day ago

@DennisFaucher

Compare pip list with this. https://github.com/THUDM/CogVideo/issues/509#issuecomment-2482129330

I had the same issue but after installing it today it got resolved (Windows 11)

DennisFaucher commented 1 day ago

Thank you