Skip to content

Update float8 tests to run nightly #1926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/float8_test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -53,3 +49,8 @@ jobs:
pip install -r dev-requirements.txt
pip install .
pytest test/float8 --verbose -s
pytest test/dtypes/test_affine_quantized_float.py --verbose -s
# Float8nocompile tests
cd torchao/prototype/float8nocompile
pytest kernels/ --verbose -s
pytest test/train_test.py --verbose -s
26 changes: 21 additions & 5 deletions test/dtypes/test_affine_quantized_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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")
Expand Down
Loading