From 41d77188c2f22717a7613f59fa5d678713d720d4 Mon Sep 17 00:00:00 2001 From: jainapurva Date: Wed, 19 Mar 2025 11:32:28 -0700 Subject: [PATCH 1/2] Update float8 tests to run nightly --- .github/workflows/float8_test.yml | 20 +++++++++-------- test/dtypes/test_affine_quantized_float.py | 26 +++++++++++++++++----- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/float8_test.yml b/.github/workflows/float8_test.yml index 915c5872b2..3cf708d603 100644 --- a/.github/workflows/float8_test.yml +++ b/.github/workflows/float8_test.yml @@ -1,14 +1,10 @@ -name: Run Float8 Tests +name: Run Float8 Tests Nightly on: - push: - branches: - - main - - 'gh/**' - pull_request: - branches: - - main - - 'gh/**' + schedule: + # 3.27 am PST every day + - cron: "27 11 * * *" + workflow_dispatch: concurrency: group: float8_test-${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} @@ -53,3 +49,9 @@ jobs: pip install -r dev-requirements.txt pip install . pytest test/float8 --verbose -s + pytest test/dtypes/test_affine_quantized_float.py --verbose -s + pytest test/dtypes/test_affine_quantized_tensor_parallel.py --verbose -s + # Float8nocompile tests + cd torchao/prototype/float8nocompile + pytest kernels/ --verbose -s + pytest test/train_test.py --verbose -s diff --git a/test/dtypes/test_affine_quantized_float.py b/test/dtypes/test_affine_quantized_float.py index 78004c6f5e..410ab9f42a 100644 --- a/test/dtypes/test_affine_quantized_float.py +++ b/test/dtypes/test_affine_quantized_float.py @@ -147,7 +147,10 @@ def test_fp8_linear_variants( ) def test_invalid_granularity(self): with pytest.raises(ValueError, match="Invalid granularity specification"): - float8_dynamic_activation_float8_weight(granularity="invalid") + model = ToyLinearModel(64, 64).eval().to(torch.float32).to("cuda") + quantize_( + model, float8_dynamic_activation_float8_weight(granularity="invalid") + ) @unittest.skipIf( not is_sm_at_least_89(), "Requires GPU with compute capability >= 8.9" @@ -157,7 +160,13 @@ def test_mismatched_granularity(self): ValueError, match="Different granularities for activation and weight are not supported", ): - float8_dynamic_activation_float8_weight(granularity=(PerTensor(), PerRow())) + model = ToyLinearModel(64, 64).eval().to(torch.float32).to("cuda") + quantize_( + model, + float8_dynamic_activation_float8_weight( + granularity=(PerTensor(), PerRow()) + ), + ) @unittest.skipIf( not is_sm_at_least_89(), "Requires GPU with compute capability >= 8.9" @@ -166,9 +175,16 @@ def test_unsupported_granularity(self): class UnsupportedGranularity: pass - with pytest.raises(ValueError, match="Invalid granularity types"): - float8_dynamic_activation_float8_weight( - granularity=(UnsupportedGranularity(), UnsupportedGranularity()) + with pytest.raises( + ValueError, + match="Invalid granularity types:", + ): + model = ToyLinearModel(64, 64).eval().to(torch.float32).to("cuda") + quantize_( + model, + float8_dynamic_activation_float8_weight( + granularity=(UnsupportedGranularity(), UnsupportedGranularity()) + ), ) @unittest.skipIf(not torch.cuda.is_available(), "Need CUDA available") From 50dad46fb6159ed800c095229b620d211d2503ac Mon Sep 17 00:00:00 2001 From: Apurva Jain Date: Wed, 19 Mar 2025 16:24:53 -0700 Subject: [PATCH 2/2] Update float8_test.yml --- .github/workflows/float8_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/float8_test.yml b/.github/workflows/float8_test.yml index 3cf708d603..b96e533537 100644 --- a/.github/workflows/float8_test.yml +++ b/.github/workflows/float8_test.yml @@ -50,7 +50,6 @@ jobs: pip install . pytest test/float8 --verbose -s pytest test/dtypes/test_affine_quantized_float.py --verbose -s - pytest test/dtypes/test_affine_quantized_tensor_parallel.py --verbose -s # Float8nocompile tests cd torchao/prototype/float8nocompile pytest kernels/ --verbose -s