kijai / ComfyUI-ELLA-wrapper

Simple wrapper to try out ELLA in ComfyUI using diffusers
Apache License 2.0
111 stars 7 forks source link

issue: RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 32 but got size 31 for tensor number 1 in the list. #16

Open ltdrdata opened 7 months ago

ltdrdata commented 7 months ago

workflow (17) (workflow attached)

Images are generated normally at 2048x2048 and 1920x2048 resolutions. If you try to generate an image at 1984x2048, an error occurs, and once an error occurs, changing the resolution continues to cause errors. (event if 2048x2048, 1920x2048)

got prompt
It seems like you have activated model offloading by calling `enable_model_cpu_offload`, but are now manually moving the pipeline to GPU. It is strongly recommended against doing so as memory gains from offloading are likely to be lost. Offloading automatically takes care of moving the individual components vae, text_encoder, tokenizer, unet, scheduler, safety_checker, feature_extractor, image_encoder to GPU when needed. To make sure offloading works as expected, you should consider moving the pipeline back to CPU: `pipeline.to('cpu')` or removing the move altogether if you use offloading.
  0%|          | 0/25 [00:00<?, ?it/s]
!!! Exception during processing!!! Sizes of tensors must match except in dimension 1. Expected size 32 but got size 31 for tensor number 1 in the list.
Traceback (most recent call last):
  File "/mnt/teratera/git/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/git/ComfyUI/execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/git/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/git/ComfyUI/custom_nodes/ComfyUI-ELLA-wrapper/nodes.py", line 422, in process
    images = pipe(
             ^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py", line 971, in __call__
    noise_pred = self.unet(
                 ^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1561, in _call_impl
    result = forward_call(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/accelerate/hooks.py", line 165, in new_forward
    output = module._old_forward(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/diffusers/models/unets/unet_2d_condition.py", line 1281, in forward
    sample = upsample_block(
             ^^^^^^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/teratera/venv-stable/lib/python3.11/site-packages/diffusers/models/unets/unet_2d_blocks.py", line 2512, 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 32 but got size 31 for tensor number 1 in the list.

Prompt executed in 0.24 seconds
#2 [diffusers_sampler]: 0.24s
kijai commented 7 months ago

Seems to be a bug in the HiDiffusion code, couldn't find it myself, probably should report to their repository. There was another dimension specific bug they fixed, but it didn't fix this one.