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

Fix flaky test_batching_equivalence #35564

Merged
merged 8 commits into from
Jan 9, 2025
Merged

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Jan 8, 2025

What does this PR do?

I am the king serial killer of flaky tests in transformers!

The the ratio of failures:

  • tests/models/flaubert/test_modeling_flaubert.py::FlaubertModelTest::test_batching_equivalence:
    • 3000 runs:
      • main: 1.2 %
      • PR: 0 %
  • tests/models/mobilevitv2/test_modeling_mobilevitv2.py::MobileViTV2ModelTest::test_batching_equivalence:
    • 300 runs:
      • main: 2.3 %
      • PR: 0 %
  • tests/models/xlm/test_modeling_xlm.py::XLMModelTest::test_batching_equivalence:
    • 300 runs:
      • main: 3.3 %
      • PR: 0 %

I will apply the same changes to overwritten tests wherever they are flaky too.

@ydshieh ydshieh force-pushed the fix_flaky_test_batching_equivalence branch from 223bfe2 to 39d3a35 Compare January 8, 2025 16:01
@ydshieh ydshieh marked this pull request as ready for review January 8, 2025 16:01
@ydshieh
Copy link
Collaborator Author

ydshieh commented Jan 8, 2025

@gante @zucchini-nlp

For context: see previous similar fixes #34995

@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 ydshieh requested a review from Rocketknight1 as a code owner January 8, 2025 16:32
@ydshieh ydshieh marked this pull request as draft January 8, 2025 17:45
@ydshieh ydshieh marked this pull request as ready for review January 8, 2025 18:47
Comment on lines +1423 to +1424
if hasattr(test_case.model_tester, "out_features") or hasattr(test_case.model_tester, "out_indices"):
target_num_hidden_layers = None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

some vision models is hard to adjust the number of layers as sometimes other parameters have to be changed at the same time

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Yay, less flaky tests! Thanks!

@ydshieh
Copy link
Collaborator Author

ydshieh commented Jan 9, 2025

There are some model test cases overwrite the common one with is_flaky.
I decide to merge this PR first, and in a follow-up PR to try to remove those overwritten tests.

@ydshieh ydshieh merged commit 1b2f942 into main Jan 9, 2025
26 checks passed
@ydshieh ydshieh deleted the fix_flaky_test_batching_equivalence branch January 9, 2025 13:00
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