Skip to content

训练的时候报错 the size of tensor a (4) must match the size of tensor b (5) at non-singleton dimension 2 #1077

@sugelamyd123

Description

@sugelamyd123

num_frames % 4 != 1. We round it up to 17.
num_frames % 4 != 1. We round it up to 17.
num_frames % 4 != 1. We round it up to 17.
num_frames % 4 != 1. We round it up to 17.
num_frames % 4 != 1. We round it up to 17.
num_frames % 4 != 1. We round it up to 17.
0%| | 0/1 [00:11<?, ?it/s]
[rank3]: Traceback (most recent call last):
[rank3]: File "/workspace/Wan2.1-main/Finetune/DiffSynth-Studio-main/train.py", line 136, in
[rank3]: launch_training_task(dataset, model, model_logger, args=args)
[rank3]: File "/workspace/Wan2.1-main/Finetune/DiffSynth-Studio-main/diffsynth/trainers/utils.py", line 559, in launch_training_task
[rank3]: loss = model(data)
[rank3]: ^^^^^^^^^^^
[rank3]: File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank3]: return self._call_impl(*args, **kwargs)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
[rank3]: return forward_call(*args, **kwargs)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/opt/conda/lib/python3.11/site-packages/deepspeed/utils/nvtx.py", line 20, in wrapped_fn
[rank3]: ret_val = func(*args, **kwargs)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/opt/conda/lib/python3.11/site-packages/deepspeed/runtime/engine.py", line 2179, in forward
[rank3]: loss = self.module(*inputs, **kwargs)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
[rank3]: return self._call_impl(*args, **kwargs)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1603, in _call_impl
[rank3]: result = forward_call(*args, **kwargs)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/workspace/Wan2.1-main/Finetune/DiffSynth-Studio-main/train.py", line 90, in forward
[rank3]: loss = self.pipe.training_loss(**models, **inputs)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/workspace/Wan2.1-main/Finetune/DiffSynth-Studio-main/diffsynth/pipelines/wan_video_new.py", line 119, in training_loss
[rank3]: inputs["latents"] = self.scheduler.add_noise(inputs["input_latents"], inputs["noise"], timestep)
[rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank3]: File "/workspace/Wan2.1-main/Finetune/DiffSynth-Studio-main/diffsynth/schedulers/flow_match.py", line 99, in add_noise
[rank3]: sample = (1 - sigma) * original_samples + sigma * noise
[rank3]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
[rank3]: RuntimeError: The size of tensor a (4) must match the size of tensor b (5) at non-singleton dimension 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions