Skip to content

unet/unet_3d_blocks/.py - dimension size mismatche #10178

@HoseinRanjbar

Description

@HoseinRanjbar

Describe the bug

I encountered a RuntimeError while running the pipeline in the ControlNext-SVD-v2 project. When I set the resolution of the video except for certain numbers, I got the following error. The error is related to tensor size mismatches during the forward pass in the unet_3d_blocks module. Below is the full traceback of the error:

Reproduction

Clone the ControlNext-SVD-v2 repository.
Setup the required environment by installing dependencies as specified in the project.
Run the script run_controlnext.py.
The error appears during the pipeline execution.

Logs

Traceback (most recent call last):
  File "/ControlNext/ControlNext-SVD-v2/run_controlnext.py", line 274, in <module>
    video_frames = pipeline(
  File "/controlNext/.env/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/ControlNext/ControlNext-SVD-v2/pipeline/pipeline_stable_video_diffusion_controlnext.py", line 588, in __call__
    noise_pred = self.unet(
  File "/controlNext/.env/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/controlNext/.env/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
    return forward_call(*args, **kwargs)
  File "/controlNext/.env/lib/python3.12/site-packages/accelerate/hooks.py", line 170, in new_forward
    output = module._old_forward(*args, **kwargs)
  File "/ControlNext/ControlNext-SVD-v2/models/unet_spatio_temporal_condition_controlnext.py", line 491, in forward
    sample = upsample_block(
  File "/controlNext/.env/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/controlNext/.env/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
    return forward_call(*args, **kwargs)
  File "/controlNext/.env/lib/python3.12/site-packages/diffusers/models/unets/unet_3d_blocks.py", line 1494, in forward
    hidden_states = torch.cat([hidden_states, res_hidden_states], dim=1)

RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 26 but got size 25 for tensor number 1 in the list.

System Info

Ubuntu 22

Who can help?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions