From 2b483230a1f79e2127b62032ef42d388ba1f991f Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Tue, 29 Mar 2022 22:12:27 +0200 Subject: [PATCH] Raise diff tolerance value for TFViTMAEModelTest (#16483) * Raise diff tolerance value Co-authored-by: ydshieh --- tests/vit_mae/test_modeling_tf_vit_mae.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/vit_mae/test_modeling_tf_vit_mae.py b/tests/vit_mae/test_modeling_tf_vit_mae.py index c0fb848569..e978fabb33 100644 --- a/tests/vit_mae/test_modeling_tf_vit_mae.py +++ b/tests/vit_mae/test_modeling_tf_vit_mae.py @@ -427,7 +427,9 @@ class TFViTMAEModelTest(TFModelTesterMixin, unittest.TestCase): tf_outputs[pt_nans] = 0 max_diff = np.amax(np.abs(tf_outputs - pt_outputs)) - self.assertLessEqual(max_diff, 1e-5) + # Set a higher tolerance (2e-5) here than the one in the common test (1e-5). + # TODO: A deeper look to decide the best (common) tolerance for the test to be strict but not too flaky. + self.assertLessEqual(max_diff, 2e-5) else: raise ValueError( f"`tf_outputs` should be a `tuple` or an instance of `tf.Tensor`. Got {type(tf_outputs)} instead."