Skip to content

Bug Fix for issue #34294#34295

Merged
ArthurZucker merged 1 commit intohuggingface:mainfrom
fpgaminer:main
Oct 31, 2024
Merged

Bug Fix for issue #34294#34295
ArthurZucker merged 1 commit intohuggingface:mainfrom
fpgaminer:main

Conversation

@fpgaminer
Copy link
Contributor

@fpgaminer fpgaminer commented Oct 21, 2024

Update SiglipVisionEmbeddings.forward to cast input to correct dtype before embedding it.

Fixes #34294

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@amyeroberts @qubvel

Update SiglipVisionEmbeddings.forward to cast input to correct dtype before embedding it.
Copy link
Contributor

@qubvel qubvel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

Comment for core maintainers
Update SigLIP similar to CLIP:

target_dtype = self.patch_embedding.weight.dtype
patch_embeds = self.patch_embedding(pixel_values.to(dtype=target_dtype)) # shape = [*, width, grid, grid]

@qubvel qubvel requested a review from ArthurZucker October 30, 2024 10:27
Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🤗

@ArthurZucker ArthurZucker merged commit c443d8d into huggingface:main Oct 31, 2024
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
Update SiglipVisionEmbeddings.forward to cast input to correct dtype before embedding 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

Successfully merging this pull request may close these issues.

SiglipVisionEmbeddings doesn't cast pixel_values like CLIPVisionEmbeddings does

3 participants