cubiq / ComfyUI_IPAdapter_plus

GNU General Public License v3.0
4.11k stars 312 forks source link

Error(s) in loading state_dict for ImageProjModel: size mismatch for proj.weight: copying a param with shape torch.Size([3072, 1280]) from checkpoint, the shape in current model is torch.Size([3072, 768]). #621

Closed xixi-97-byte closed 4 months ago

xixi-97-byte commented 4 months ago

hello,cubiq,when I run the ipadapter,something wrong happened,If it is possible,could you please give me some help. Forward your response. Error occurred when executing IPAdapterAdvanced:

Error(s) in loading state_dict for ImageProjModel: size mismatch for proj.weight: copying a param with shape torch.Size([3072, 1280]) from checkpoint, the shape in current model is torch.Size([3072, 768]).

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\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 "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 769, in apply_ipadapter work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, ipa_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 396, in ipadapter_execute ipa = IPAdapter( ^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 70, in init self.image_proj_model.load_state_dict(ipadapter_model["image_proj"]) File "D:\ComfyUI_windows_portable\ComfyUI.ext\Lib\site-packages\torch\nn\modules\module.py", line 2189, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(

cubiq commented 4 months ago

you are probably using the wrong combination of models, possibly a wrong controlnet (like an sdxl controlnet with an sd1.5 checkpoint or vice versa). Or something like that

xixi-97-byte commented 4 months ago

I do not know maybe the ipadapter is embeded any models in itself,or I can choose the model by myself?

cubiq commented 4 months ago

can I see the workflow?

xixi-97-byte commented 4 months ago

of course.and thank you so much. 个人建立.json

cubiq commented 4 months ago

I don't get any error, be sure your file are not corrupted. Sometimes they get corrupted when downloading them

xixi-97-byte commented 4 months ago

so sad,or maybe could you please tell me how to set up, such as the correspondence between the ipadapter model and the clipvision model? Hope I will not disturb you so much.

DucNM-media commented 3 months ago

@xixi-97-byte Have you fixed the error yet? I'm also experiencing the same issue :((

520xielaoban commented 3 months ago

我也是,报错 RuntimeError: Error(s) in loading state_dict for ImageProjModel: size mismatch for proj.weight: copying a param with shape torch.Size([8192, 1024]) from checkpoint, the shape in current model is torch.Size([8192, 768]).

520xielaoban commented 3 months ago

需要注意,其中名字带有 sd15 适用于 sd15 大模型,带有 sdxl 的适用于 sdxl 大模型;

其中名字带有 vit-h 的使用 ViT-H 视觉编码器,名字带有 vit-G 的使用 ViT-G 视觉编码器;

SDXL 大模型默认使用 ViT-G,SD15 大模型默认使用 ViT-H。 ———————————————— clip视频编码器

Kevinchen985 commented 2 months ago

@xixi-97-byte CLIP-ViT-H-14-laion2B-s32B-b79K / CLIP-ViT-bigG-14-laion2B-39B-b160k 这两个文件你可能命名反了,检查一下

xixi-97-byte commented 2 months ago

@xixi-97-byte Have you fixed the error yet? I'm also experiencing the same issue :((

not yet

LAWSON666888 commented 2 months ago

我也遇到了同样的问题,模型和编码器在一一对应的情况下,还是报错“ File "F:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 2215, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Resampler: size mismatch for proj_in.weight: copying a param with shape torch.Size([768, 1280]) from checkpoint, the shape in current model is torch.Size([768, 1664]).” 不知道怎么回事···

DoryAi commented 3 hours ago

Change Load clip vison = CLIP-ViT-H-14-laion2B-s32B-b79K. Sure