Wrong shape when loading IP-Adapter-FaceID-plus

#10
by ironbar - opened

Hi,
I have been following the sample code to use the FaceID-plus and I get the following error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-1-94e813142ee5> in <cell line: 35>()
     33 
     34 # load ip-adapter
---> 35 ip_model = IPAdapterFaceIDPlus(pipe, image_encoder_path, ip_ckpt, device)
     36 
     37 # generate image

2 frames
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict, assign)
   2150 
   2151         if len(error_msgs) > 0:
-> 2152             raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
   2153                                self.__class__.__name__, "\n\t".join(error_msgs)))
   2154         return _IncompatibleKeys(missing_keys, unexpected_keys)

RuntimeError: Error(s) in loading state_dict for ProjPlusModel:
    size mismatch for perceiver_resampler.proj_in.weight: copying a param with shape torch.Size([768, 1280]) from checkpoint, the shape in current model is torch.Size([768, 1664]).

There seems to be a mismatch between the model weights and the expected weights size.

use wrong image encoder, should be image_encoder_path = "h94/IP-Adapter/models/image_encoder" (not sdxl_models)

Thanks! Now it works!

ironbar changed discussion status to closed

Sign up or log in to comment