Gourieff / comfyui-reactor-node

Fast and Simple Face Swap Extension Node for ComfyUI
GNU General Public License v3.0
1.39k stars 133 forks source link

RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 3 but got size 4 #378

Closed glynisbrits closed 1 day ago

glynisbrits commented 1 month ago

First, confirm

What happened?

When combining Reactor Fast Face swap with a video input (using VHS for the input), if there is no face in an input image the Masking Helper node fails.

Steps to reproduce the problem

Your workflow VHS Load Video -> Image Batch to Image List -> Reactor Fast Face Swap (using a pre-generated face model) -> Reactor Masking Helper (takes input image from Image Batch to Image List, and Swapped Image from Reactor Fast Face Swap -> Image List to Image Batch -> VHS Combine

Sysinfo

MacBook Pro 16" M1, macOS Sonoma

Relevant console log

!!! Exception during processing!!! Sizes of tensors must match except in dimension 0. Expected size 3 but got size 4 for tensor number 1 in the list.
Traceback (most recent call last):
  File "/Users/andrewbrits/Library/Application Support/StabilityMatrix/Packages/ComfyUI/execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/Users/andrewbrits/Library/Application Support/StabilityMatrix/Packages/ComfyUI/execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/Users/andrewbrits/Library/Application Support/StabilityMatrix/Packages/ComfyUI/execution.py", line 66, in map_node_over_list
    results.append(getattr(obj, func)(**input_data_all))
  File "/Users/andrewbrits/Library/Application Support/StabilityMatrix/Packages/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/util_nodes.py", line 335, in doit
    image1 = torch.cat((image1, image2), dim=0)
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 3 but got size 4 for tensor number 1 in the list.

Additional information

No response

Gourieff commented 1 month ago

Try to use RGBA to RGB node (ImageRGBA2RGB) before "Image List to Image Batch"

glynisbrits commented 1 month ago

Same error

RodrigoSKohl commented 1 month ago

Same error

I tried to reproduce the problem here and was unable to do so. Try force_size in VHS Load Video

crmbz0r commented 1 week ago

Check https://github.com/Gourieff/comfyui-reactor-node/issues/280#issuecomment-2067108049 this might be your solution

(or try like this) Screenshot 2024-09-02 181939