RuntimeError: Error(s) in loading state_dict for LlavaForConditionalGeneration

#2
by floschne - opened

Hi,

I am getting the folloing error when trying to load the model:

  File "/home/aiscuser/lmmm/./scripts/eval/eval_xgqa.py", line 64, in load_model
    LlavaForConditionalGeneration.from_pretrained(
  File "/home/aiscuser/miniforge3/envs/lmmm/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3852, in from_pretrained
    ) = cls._load_pretrained_model(
  File "/home/aiscuser/miniforge3/envs/lmmm/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4337, in _load_pretrained_model
    raise RuntimeError(f"Error(s) in loading state_dict for {model.__class__.__name__}:\n\t{error_msg}")
RuntimeError: Error(s) in loading state_dict for LlavaForConditionalGeneration:
        size mismatch for multi_modal_projector.linear_1.weight: copying a param with shape torch.Size([4096, 5120]) from checkpoint, the shape in current model is torch.Size([4096, 1024]).
        You may consider adding `ignore_mismatched_sizes=True` in the model `from_pretrained` method.
Llava Hugging Face org

Hi,

You need to use the VipLlavaForConditionalGeneration class to load the weights, not LlavaForConditionalGeneration.

Oh, thanks! I totally overlooked this...

floschne changed discussion status to closed

Sign up or log in to comment