Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torch size mismatch #154

Open
AWAS666 opened this issue Nov 10, 2024 · 1 comment
Open

Torch size mismatch #154

AWAS666 opened this issue Nov 10, 2024 · 1 comment

Comments

@AWAS666
Copy link

AWAS666 commented Nov 10, 2024

Just cloned this repo and running into a torch size mismatch error.
If I do set the "ignore_mismatched_sizes" flag on the model it seems to run though, still weird.

Using python 3.10.12

Error log:

Traceback (most recent call last):
  File "/home/userName/Documents/moondream/batch_generate_example.py", line 10, in <module>
    moondream = Moondream.from_pretrained(
  File "/home/userName/Documents/moondream/venv/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3941, in from_pretrained
    ) = cls._load_pretrained_model(
  File "/home/userName/Documents/moondream/venv/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4473, 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 Moondream:
        size mismatch for region_model.size_features.weight: copying a param with shape torch.Size([128, 2]) from checkpoint, the shape in current model is torch.Size([256, 2]).
        size mismatch for region_model.size_encoder.weight: copying a param with shape torch.Size([2048, 256]) from checkpoint, the shape in current model is torch.Size([2048, 512]).
        You may consider adding `ignore_mismatched_sizes=True` in the model `from_pretrained` method.
@vikhyat
Copy link
Owner

vikhyat commented Nov 18, 2024

Can be ignored for now (via ignore_mismatched_sizes=True) -- the region model is for the next upcoming version of the model, the current version doesn't use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants