cubiq / ComfyUI_Workflows

A repository of well documented easy to follow workflows for ComfyUI
Apache License 2.0
292 stars 17 forks source link

Error occurred when executing StyleModelApply: Sizes of tensors must match except in dimension 1 #3

Open MMoneer opened 6 months ago

MMoneer commented 6 months ago

Hello, I got this error when trying to use the style model workflow.

brave_13012024_031

Error occurred when executing StyleModelApply:

Sizes of tensors must match except in dimension 1. Expected size 1280 but got size 1024 for tensor number 1 in the list.

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 154, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 84, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 77, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 923, in apply_stylemodel cond = style_model.get_cond(clip_vision_output).flatten(start_dim=0, end_dim=1).unsqueeze(dim=0) File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 290, in get_cond return self.model(input.last_hidden_state) File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "D:\ComfyUI_windows_portable\ComfyUI\comfy\t2i_adapter\adapter.py", line 214, in forward x = torch.cat([x, style_embedding], dim=1)

Kallamamran commented 4 months ago

I have the same error :(

MMoneer commented 4 months ago

I have the same error :(

Add --force-fp16 to run_nvidia_gpu.bat

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --force-fp16
pause
Kallamamran commented 4 months ago

Still same problem unfortunately. Would you mind sharing a working workflow so I can test and see if I have missed something? Never mind the images. Those are just a trial and error. Have tried changing resolution of images, scalers and everything. image

MMoneer commented 4 months ago

I'm so sorry, I mixed up the topics. This is not a solution to this problem, This didn't fix it for me too. The --force-fp16 is for Dtype mismatch issue, not the tensor mismatch. To Fix it you can download this clip vision https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/pytorch_model.bin?download=true It's work for me brave_20032024_044

MMoneer commented 4 months ago

You can Save it as clip-vit-large-patch14.bin instead of pytorch_model.bin Also, switch between t2iadapter_style_sd14v1.pth and coadapter-style-sd15v1.pth to figure out which one you like