From 28f2619868805a11f3afd03a7428ef10d1653752 Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:30:40 +0200 Subject: [PATCH] skip `Glm4MoeModelTest::test_torch_compile_for_training` (#39670) * fix * fix * fix --------- Co-authored-by: ydshieh --- tests/models/glm4_moe/test_modeling_glm4_moe.py | 4 ++-- tests/test_modeling_common.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/models/glm4_moe/test_modeling_glm4_moe.py b/tests/models/glm4_moe/test_modeling_glm4_moe.py index f348bd4b8d..176a7c4382 100644 --- a/tests/models/glm4_moe/test_modeling_glm4_moe.py +++ b/tests/models/glm4_moe/test_modeling_glm4_moe.py @@ -79,8 +79,8 @@ class Glm4MoeModelTest(CausalLMModelTest, unittest.TestCase): test_pruning = False fx_compatible = False model_tester_class = Glm4MoeModelTester - # used in `test_torch_compile_for_training` - _torch_compile_train_cls = Glm4MoeForCausalLM if is_torch_available() else None + # used in `test_torch_compile_for_training`. Skip as "Dynamic control flow in MoE" + _torch_compile_train_cls = None @require_torch_accelerator diff --git a/tests/test_modeling_common.py b/tests/test_modeling_common.py index 38c581992b..4559fde9c3 100755 --- a/tests/test_modeling_common.py +++ b/tests/test_modeling_common.py @@ -4476,7 +4476,7 @@ class ModelTesterMixin: if version.parse(torch.__version__) < version.parse("2.3"): self.skipTest(reason="This test requires torch >= 2.3 to run.") - if not hasattr(self, "_torch_compile_train_cls"): + if getattr(self, "_torch_compile_train_cls", None) is None: self.skipTest(f"{self.__class__.__name__} doesn't have the attribute `_torch_compile_train_cls`.") config, _ = self.model_tester.prepare_config_and_inputs_for_common()