Avoid T5GemmaModelTest::test_eager_matches_sdpa_inference being flaky#40702
Merged
Avoid T5GemmaModelTest::test_eager_matches_sdpa_inference being flaky#40702
T5GemmaModelTest::test_eager_matches_sdpa_inference being flaky#40702Conversation
T5GemmaModelTest::test_eager_matches_sdpa_inference being flaky
ydshieh
commented
Sep 4, 2025
| input_ids = torch.where(input_ids == self.bos_token_id, 42, input_ids) | ||
| decoder_input_ids = torch.where(decoder_input_ids == self.bos_token_id, 42, decoder_input_ids) | ||
|
|
||
| # Avoid leading PAD tokens from inputs. |
Collaborator
Author
There was a problem hiding this comment.
we probably better to force this for all model tester classes
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: t5gemma |
manueldeprada
approved these changes
Sep 4, 2025
Contributor
manueldeprada
left a comment
There was a problem hiding this comment.
😮 nice detective work!! ofc, argmax over -inf mask is very unstable, I remember chasing something similar.
I agree we should search similar cases. Maybe adding a check in PretrainedModel.forward() so that sum of key projections >>> -inf? and then locally run the testsuite and see if that conditions triggers?
Collaborator
Author
|
Leave as a TODO, got to sleep now 😴 Thanks a lot for approving. |
|
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. |
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.
What does this PR do?
See https://app.circleci.com/pipelines/github/huggingface/transformers/144943/workflows/f4bc060c-b21f-4528-9393-9fadc27fe49e/jobs/1916024
This is specific to
T5GemmaForTokenClassification(maybeT5GemmaForSequenceClassificationtoo), as they specifyand goes through
The logic is correct, but a sequence of no place to attend is problematic in terms of numerical equivalence.