[Gemma Embedding] Fix SWA#40700
Merged
Cyrilvallez merged 5 commits intohuggingface:mainfrom Sep 5, 2025
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
vasqu
commented
Sep 4, 2025
Contributor
Author
|
Alternatively, we could change the Edit: See https://github.com/vasqu/transformers/pull/1/files |
Member
|
Nice! Thanks for the fix! Indeed, I'd rather change the flag in the init if you don't mind, so we don't have to change the sdpa integration! 🤗 |
Gemma Embedding] Fix Flash Attention usageGemma Embedding] Fix SWA
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: gemma3, gemma3n |
Cyrilvallez
pushed a commit
that referenced
this pull request
Sep 5, 2025
* fix gemma embedding flash attention * fix sdpa * fix atttempt number 2 * alternative gemma fix * fix modular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue at hand
(SW-1, SW // 2)instead of the intended(SW // 2, SW // 2)(SW-1, SW-1)The fix
Scripts
For sanity check, use the following script:
For visualization:
And insert/debug right after the masks in the models with
Before fix:


After fix:
cc @Cyrilvallez @tomaarsen