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

Make test_generate_with_static_cache even less flaky #34995

Merged
merged 10 commits into from
Dec 20, 2024
Merged

Make test_generate_with_static_cache even less flaky #34995

merged 10 commits into from
Dec 20, 2024

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Nov 28, 2024

What does this PR do?

#34464 make some generate tests less flaky. However, with

tests/models/paligemma/test_modeling_paligemma.py::PaliGemmaForConditionalGenerationModelTest::test_generate_with_static_cache

it fails 0.6% of the time.

This PR takes the same idea in #34558 to make test_generate_with_static_cache even much less flaky. Running 2000 times and all pass.

It also make this process easier to applied to other tests in the future whenever necessary

@ydshieh ydshieh requested a review from ArthurZucker November 28, 2024 12:49
@HuggingFaceDocBuilderDev

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.

@ydshieh
Copy link
Collaborator Author

ydshieh commented Nov 28, 2024

also fixed

tests/models/persimmon/test_modeling_persimmon.py::PersimmonModelTest::test_generate_with_static_cache

@@ -835,7 +835,12 @@ def test_generation_languages(self):
def test_speech_generation(self):
Copy link
Collaborator Author

@ydshieh ydshieh Nov 28, 2024

Choose a reason for hiding this comment

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

tests/models/seamless_m4t_v2test_modeling_seamless_m4t_v2.py::SeamlessM4Tv2GenerationTest::test_speech_generation

previously failed 50% of the time. Now running 300 times and all pass.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Run 500 times

tests/models/musicgen_melody/test_modeling_musicgen_melody.py::MusicgenMelodyDecoderTest::test_eager_matches_sdpa_inference_1_bfloat16

2 failed (before) v.s. 0 failed with PR

tests/models/musicgen_melody/test_modeling_musicgen_melody.py::MusicgenMelodyTest::test_eager_matches_sdpa_inference_1_bfloat16

3 failed (before) v.s. 0 failed with PR

@ydshieh
Copy link
Collaborator Author

ydshieh commented Nov 28, 2024

tests/models/persimmon/test_modeling_persimmon.py::PersimmonModelTest::test_generate_with_static_cache

200 runs: 8 failed (before) v.s 0 failed (PR)

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.

Cool, I like that we have some utils that can be re-used!

@ydshieh ydshieh merged commit 504c4d3 into main Dec 20, 2024
26 checks passed
@ydshieh ydshieh deleted the fix_flaky_3 branch December 20, 2024 15:03
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.

3 participants