instantX-research / InstantID

InstantID: Zero-shot Identity-Preserving Generation in Seconds 🔥
https://instantid.github.io/
Apache License 2.0
11.14k stars 810 forks source link

ip_adapter weight size mismatch #241

Open YuZijian opened 5 months ago

YuZijian commented 5 months ago

Run infer.py cause below error I try to download by scripts or from https://huggingface.co/InstantX/InstantID/blob/main/ip-adapter.bin

Loading pipeline components...: 100%|████████████████████████████████████████████████████████████████████████████████████| 7/7 [01:16<00:00, 10.91s/it] Traceback (most recent call last): File "/root/InstantID/infer.py", line 57, in pipe.load_ip_adapter_instantid(face_adapter) File "/root/InstantID/pipeline_stable_diffusion_xl_instantid.py", line 160, in load_ip_adapter_instantid self.set_ip_adapter(model_ckpt, num_tokens, scale) File "/root/InstantID/pipeline_stable_diffusion_xl_instantid.py", line 212, in set_ip_adapter ip_layers.load_state_dict(state_dict) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 2153, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for ModuleList: Unexpected key(s) in state_dict: "45.to_k_ip.weight", "45.to_v_ip.weight", "47.to_k_ip.weight", "47.to_v_ip.weight", "49.to_k_ip.weight", "49.to_v_ip.weight", "51.to_k_ip.weight", "51.to_v_ip.weight", "53.to_k_ip.weight", "53.to_v_ip.weight", "55.to_k_ip.weight", "55.to_v_ip.weight", "57.to_k_ip.weight", "57.to_v_ip.weight", "59.to_k_ip.weight", "59.to_v_ip.weight", "61.to_k_ip.weight", "61.to_v_ip.weight", "63.to_k_ip.weight", "63.to_v_ip.weight", "65.to_k_ip.weight", "65.to_v_ip.weight", "67.to_k_ip.weight", "67.to_v_ip.weight", "69.to_k_ip.weight", "69.to_v_ip.weight", "71.to_k_ip.weight", "71.to_v_ip.weight", "73.to_k_ip.weight", "73.to_v_ip.weight", "75.to_k_ip.weight", "75.to_v_ip.weight", "77.to_k_ip.weight", "77.to_v_ip.weight", "79.to_k_ip.weight", "79.to_v_ip.weight", "81.to_k_ip.weight", "81.to_v_ip.weight", "83.to_k_ip.weight", "83.to_v_ip.weight", "85.to_k_ip.weight", "85.to_v_ip.weight", "87.to_k_ip.weight", "87.to_v_ip.weight", "89.to_k_ip.weight", "89.to_v_ip.weight", "91.to_k_ip.weight", "91.to_v_ip.weight", "93.to_k_ip.weight", "93.to_v_ip.weight", "95.to_k_ip.weight", "95.to_v_ip.weight", "97.to_k_ip.weight", "97.to_v_ip.weight", "99.to_k_ip.weight", "99.to_v_ip.weight", "101.to_k_ip.weight", "101.to_v_ip.weight", "103.to_k_ip.weight", "103.to_v_ip.weight", "105.to_k_ip.weight", "105.to_v_ip.weight", "107.to_k_ip.weight", "107.to_v_ip.weight", "109.to_k_ip.weight", "109.to_v_ip.weight", "111.to_k_ip.weight", "111.to_v_ip.weight", "113.to_k_ip.weight", "113.to_v_ip.weight", "115.to_k_ip.weight", "115.to_v_ip.weight", "117.to_k_ip.weight", "117.to_v_ip.weight", "119.to_k_ip.weight", "119.to_v_ip.weight", "121.to_k_ip.weight", "121.to_v_ip.weight", "123.to_k_ip.weight", "123.to_v_ip.weight", "125.to_k_ip.weight", "125.to_v_ip.weight", "127.to_k_ip.weight", "127.to_v_ip.weight", "129.to_k_ip.weight", "129.to_v_ip.weight", "131.to_k_ip.weight", "131.to_v_ip.weight", "133.to_k_ip.weight", "133.to_v_ip.weight", "135.to_k_ip.weight", "135.to_v_ip.weight", "137.to_k_ip.weight", "137.to_v_ip.weight", "139.to_k_ip.weight", "139.to_v_ip.weight". size mismatch for 29.to_k_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 29.to_v_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 31.to_k_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 31.to_v_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 33.to_k_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 33.to_v_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 35.to_k_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 35.to_v_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 37.to_k_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 37.to_v_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 39.to_k_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]). size mismatch for 39.to_v_ip.weight: copying a param with shape torch.Size([1280, 2048]) from checkpoint, the shape in current model is torch.Size([640, 2048]).