From 6f37f851256855c24ed14d11456fbecdb995fde2 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Fri, 2 Feb 2024 13:43:37 +0100 Subject: [PATCH 1/2] fix / skip some tests before we can switch to torch 2.2 --- tests/models/mega/test_modeling_mega.py | 11 +++++++++++ tests/models/vits/test_modeling_vits.py | 5 +++++ tests/utils/test_model_output.py | 4 +++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/models/mega/test_modeling_mega.py b/tests/models/mega/test_modeling_mega.py index a67ee0d00328..4cd1991c8ed7 100644 --- a/tests/models/mega/test_modeling_mega.py +++ b/tests/models/mega/test_modeling_mega.py @@ -19,6 +19,7 @@ from transformers import MegaConfig, is_torch_available from transformers.testing_utils import ( TestCasePlus, + is_flaky, require_torch, require_torch_fp16, slow, @@ -534,6 +535,16 @@ def setUp(self): self.model_tester = MegaModelTester(self) self.config_tester = ConfigTester(self, config_class=MegaConfig, hidden_size=37) + # TODO: @ydshieh + @is_flaky(description="Sometimes gives `AssertionError` on expected outputs") + def test_pipeline_fill_mask(self): + super().test_pipeline_fill_mask() + + # TODO: @ydshieh + @is_flaky(description="Sometimes gives `RuntimeError: probability tensor contains either `inf`, `nan` or element < 0`") + def test_pipeline_text_generation(self): + super().test_pipeline_text_generation() + def test_config(self): self.config_tester.run_common_tests() diff --git a/tests/models/vits/test_modeling_vits.py b/tests/models/vits/test_modeling_vits.py index abae6999cdfc..c1c4117f7e20 100644 --- a/tests/models/vits/test_modeling_vits.py +++ b/tests/models/vits/test_modeling_vits.py @@ -176,6 +176,11 @@ def setUp(self): def test_config(self): self.config_tester.run_common_tests() + # TODO: @ydshieh + @is_flaky(description="torch 2.2.0 gives `Timeout >120.0s`") + def test_pipeline_feature_extraction(self): + super().test_pipeline_feature_extraction() + @unittest.skip("Need to fix this after #26538") def test_model_forward(self): set_seed(12345) diff --git a/tests/utils/test_model_output.py b/tests/utils/test_model_output.py index 33013f222ee2..b1fc3dd01314 100644 --- a/tests/utils/test_model_output.py +++ b/tests/utils/test_model_output.py @@ -155,9 +155,11 @@ def test_torch_pytree(self): if is_torch_greater_or_equal_than_2_2: self.assertEqual( pytree.treespec_dumps(actual_tree_spec), - '[1, {"type": "tests.utils.test_model_output.ModelOutputTest", "context": ["a", "c"], "children_spec": [{"type": null, "context": null, "children_spec": []}, {"type": null, "context": null, "children_spec": []}]}]', + '[1, {"type": "tests.utils.test_model_output.ModelOutputTest", "context": "[\\"a\\", \\"c\\"]", "children_spec": [{"type": null, "context": null, "children_spec": []}, {"type": null, "context": null, "children_spec": []}]}]', ) + # TODO: @ydshieh + @unittest.skip("CPU OOM") @require_torch def test_export_serialization(self): if not is_torch_greater_or_equal_than_2_2: From 7c797c64f99d988bdc5d8b85fe0b4f80bab9ddb9 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Fri, 2 Feb 2024 13:52:50 +0100 Subject: [PATCH 2/2] style --- tests/models/mega/test_modeling_mega.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/models/mega/test_modeling_mega.py b/tests/models/mega/test_modeling_mega.py index 4cd1991c8ed7..e07f4efedd7b 100644 --- a/tests/models/mega/test_modeling_mega.py +++ b/tests/models/mega/test_modeling_mega.py @@ -541,7 +541,9 @@ def test_pipeline_fill_mask(self): super().test_pipeline_fill_mask() # TODO: @ydshieh - @is_flaky(description="Sometimes gives `RuntimeError: probability tensor contains either `inf`, `nan` or element < 0`") + @is_flaky( + description="Sometimes gives `RuntimeError: probability tensor contains either `inf`, `nan` or element < 0`" + ) def test_pipeline_text_generation(self): super().test_pipeline_text_generation()