After modify file: ip_adapter_faceid.py, line:180, change from ip_layers.load_state_dict(state_dict["ip_adapter"]) to ip_layers.load_state_dict(state_dict["ip_adapter"],False), the following problem occurs:
2. Sizes of tensors must match except in dimension 1
Traceback (most recent call last):
File "/Users/wangweiwei/Library/Mobile Documents/com~apple~CloudDocs/PycharmProjects/ai-demo/faceediting/faceid.py", line 98, in <module>
main()
File "/Users/wangweiwei/Library/Mobile Documents/com~apple~CloudDocs/PycharmProjects/ai-demo/faceediting/faceid.py", line 82, in main
images = ip_model.generate(
^^^^^^^^^^^^^^^^^^
File "/Users/wangweiwei/opt/anaconda3/envs/ai-demo/lib/python3.11/site-packages/ip_adapter/ip_adapter_faceid.py", line 237, in generate
prompt_embeds = torch.cat([prompt_embeds_, image_prompt_embeds], dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 4 but got size 20 for tensor number 1 in the list.
Code
copied from https://huggingface.co/h94/IP-Adapter-FaceID:
Problem
1. Error(s) in loading state_dict for ModuleList
After modify file: ip_adapter_faceid.py, line:180, change from ip_layers.load_state_dict(state_dict["ip_adapter"]) to ip_layers.load_state_dict(state_dict["ip_adapter"],False), the following problem occurs:
2. Sizes of tensors must match except in dimension 1