Less flaky for TimmBackboneModelTest::test_batching_equivalence (#35971)

* fix

* remove is_flaky

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2025-01-30 16:56:26 +01:00
committed by GitHub
parent e320d5542e
commit 5757681837
2 changed files with 6 additions and 8 deletions

View File

@@ -768,7 +768,7 @@ class ModelTesterMixin:
else:
check_determinism(first, second)
def test_batching_equivalence(self):
def test_batching_equivalence(self, atol=1e-5, rtol=1e-5):
"""
Tests that the model supports batching and that the output is the nearly the same for the same input in
different batch sizes.
@@ -812,7 +812,7 @@ class ModelTesterMixin:
torch.isinf(single_row_object).any(), f"Single row output has `inf` in {model_name} for key={key}"
)
try:
torch.testing.assert_close(batched_row, single_row_object, atol=1e-5, rtol=1e-5)
torch.testing.assert_close(batched_row, single_row_object, atol=atol, rtol=rtol)
except AssertionError as e:
msg = f"Batched and Single row outputs are not equal in {model_name} for key={key}.\n\n"
msg += str(e)