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

PaliGemma (and probably SigLIP) inference broken in latest transformers version #33929

Closed
mranzinger opened this issue Oct 3, 2024 · 5 comments · Fixed by #33958 · May be fixed by #33965
Closed

PaliGemma (and probably SigLIP) inference broken in latest transformers version #33929

mranzinger opened this issue Oct 3, 2024 · 5 comments · Fixed by #33958 · May be fixed by #33965

Comments

@mranzinger
Copy link

This seems like a breaking change. When I run this model with transformers==4.44.2, things work fine. However, when running with transformers==4.25.1, it fails with this error:


...

    num_positions = self.position_embeddings.shape[1]

  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1687, in __getattr__

    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")

AttributeError: 'SiglipVisionEmbeddings' object has no attribute 'position_embeddings'. Did you mean: 'position_embedding'?

Originally posted by @mranzinger in c6d2848

@ArthurZucker
Copy link
Collaborator

Yep opening a PR asap cc @xenova !

@mranzinger
Copy link
Author

I think this is still broken. self.position_embedding is of type nn.Embedding, which means it doesn't have a .shape variable.

I think you want to bring back

position_embeddings = self.position_embedding.weight.unsqueeze(0)

@ArthurZucker
Copy link
Collaborator

Fixed properly this time sorry!

@ArthurZucker
Copy link
Collaborator

ArthurZucker commented Oct 4, 2024

#32600 also introduced a regression by storing position embeds twice

@mranzinger
Copy link
Author

#33965 does look better!

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