From b498738f0a8e0f855f27181af99624531fa01036 Mon Sep 17 00:00:00 2001 From: Kaining Zhong Date: Mon, 27 Apr 2026 22:55:07 +0000 Subject: [PATCH 1/2] fix: skip generating fp8 & mxfp8 checkpoints if unsupported Signed-off-by: Kaining Zhong --- tests/pytorch/test_checkpoint.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/tests/pytorch/test_checkpoint.py b/tests/pytorch/test_checkpoint.py index 0427886b84..87618044c4 100644 --- a/tests/pytorch/test_checkpoint.py +++ b/tests/pytorch/test_checkpoint.py @@ -38,6 +38,17 @@ "ops_linear.mxfp8", ) +def should_skip(name): + # Skip if quantization is not supported + quantization = None + if "." in name: + quantization = name.split(".")[1] + if quantization == "fp8" and not fp8_available: + return reason_for_no_fp8 + if quantization == "mxfp8" and not mxfp8_available: + return reason_for_no_mxfp8 + return None + class TestLoadCheckpoint: """Tests for loading checkpoint files @@ -98,6 +109,10 @@ def _checkpoint_dir() -> pathlib.Path: def _save_checkpoint(name: str, checkpoint_dir: Optional[pathlib.Path] = None) -> None: """Save a module's checkpoint file""" + skip_reason = should_skip(name) + if skip_reason is not None: + pytest.skip(skip_reason) + # Path to save checkpoint if checkpoint_dir is None: checkpoint_dir = TestLoadCheckpoint._checkpoint_dir() @@ -113,14 +128,9 @@ def _save_checkpoint(name: str, checkpoint_dir: Optional[pathlib.Path] = None) - def test_module(self, name: str) -> None: """Test for loading a module's checkpoint file""" - # Skip if quantization is not supported - quantization = None - if "." in name: - quantization = name.split(".")[1] - if quantization == "fp8" and not fp8_available: - pytest.skip(reason_for_no_fp8) - if quantization == "mxfp8" and not mxfp8_available: - pytest.skip(reason_for_no_mxfp8) + skip_reason = should_skip(name) + if skip_reason is not None: + pytest.skip(skip_reason) # Construct module module = self._make_module(name) From 551e54f051a1a9cae4d826368611170c37bf163d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 22:56:14 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/pytorch/test_checkpoint.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pytorch/test_checkpoint.py b/tests/pytorch/test_checkpoint.py index 87618044c4..62a68487f8 100644 --- a/tests/pytorch/test_checkpoint.py +++ b/tests/pytorch/test_checkpoint.py @@ -38,6 +38,7 @@ "ops_linear.mxfp8", ) + def should_skip(name): # Skip if quantization is not supported quantization = None