Skip to content

Commit ddcd50f

Browse files
Fix hadamard and FP4 gpu tests
Signed-off-by: Keval Morabia <[email protected]>
1 parent 0bea1c3 commit ddcd50f

File tree

6 files changed

+20
-27
lines changed

6 files changed

+20
-27
lines changed

.github/workflows/gpu_tests.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ name: GPU tests
33
on:
44
push:
55
branches: ["pull-request/[0-9]+"]
6-
paths:
7-
- ".github/workflows/gpu_tests.yml"
8-
- "modelopt/**"
9-
- "tests/**"
10-
- "setup.py"
11-
- "tox.ini"
6+
# TODO: paths cannot be used since push happens to copied PR and only latest commit to PR is used
7+
# paths:
8+
# - ".github/workflows/gpu_tests.yml"
9+
# - "modelopt/**"
10+
# - "tests/gpu/**"
11+
# - "setup.py"
12+
# - "tox.ini"
1213

1314
# Cancel previous runs if new commit is pushed to the same PR
1415
concurrency:
@@ -28,7 +29,7 @@ jobs:
2829
PIP_CONSTRAINT: "" # Disable pip constraint for upgrading packages
2930
steps:
3031
- uses: actions/checkout@v4
31-
- name: Install dependencies
32-
run: pip install tox-current-env
32+
- name: Setup proxy cache
33+
uses: nv-gha-runners/setup-proxy-cache@main
3334
- name: Run gpu tests
34-
run: tox -e py312-cuda12-gpu --current-env
35+
run: pip install tox-current-env && tox -e py312-cuda12-gpu --current-env

.github/workflows/multi_version_unit_tests.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
paths:
88
- ".github/workflows/multi_version_unit_tests.yml"
99
- "modelopt/**"
10-
- "tests/**"
10+
- "tests/unit/**"
1111
- "setup.py"
1212
- "tox.ini"
1313

@@ -28,10 +28,8 @@ jobs:
2828
- uses: actions/setup-python@v5
2929
with:
3030
python-version: "3.${{ matrix.py }}"
31-
- name: Install dependencies
32-
run: pip install tox
3331
- name: Run unit tests
34-
run: tox -e py3${{ matrix.py }}-torch28-unit
32+
run: pip install tox && tox -e py3${{ matrix.py }}-torch28-unit
3533
multi-torch-unit:
3634
runs-on: ubuntu-latest
3735
timeout-minutes: 30
@@ -43,7 +41,5 @@ jobs:
4341
- uses: actions/setup-python@v5
4442
with:
4543
python-version: "3.12"
46-
- name: Install dependencies
47-
run: pip install tox
4844
- name: Run unit tests
49-
run: tox -e py312-torch${{ matrix.torch }}-unit
45+
run: pip install tox && tox -e py312-torch${{ matrix.torch }}-unit

.github/workflows/partial_unit_tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths:
77
- ".github/workflows/partial_unit_tests.yml"
88
- "modelopt/**"
9-
- "tests/**"
9+
- "tests/unit/**"
1010
- "setup.py"
1111
- "tox.ini"
1212

@@ -27,7 +27,5 @@ jobs:
2727
- uses: actions/setup-python@v5
2828
with:
2929
python-version: "3.12"
30-
- name: Install dependencies
31-
run: pip install tox
3230
- name: Run unit tests
33-
run: tox -e py312-partial-unit-${{ matrix.test-env }}
31+
run: pip install tox && tox -e py312-partial-unit-${{ matrix.test-env }}

.github/workflows/unit_tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths:
77
- ".github/workflows/unit_tests.yml"
88
- "modelopt/**"
9-
- "tests/**"
9+
- "tests/unit/**"
1010
- "setup.py"
1111
- "tox.ini"
1212

@@ -27,7 +27,5 @@ jobs:
2727
- uses: actions/setup-python@v5
2828
with:
2929
python-version: "3.12"
30-
- name: Install dependencies
31-
run: pip install tox
3230
- name: Run unit tests
33-
run: tox -e py312-torch28-unit
31+
run: pip install tox && tox -e py312-torch28-unit

tests/gpu/torch/quantization/test_hadamard.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_hadamard_transform(dim):
3939
xxt = x @ x.T
4040
x_h = normalized_hadamard_transform(x)
4141
xxt_h = x_h @ x_h.T
42-
assert torch.allclose(xxt_h, xxt, atol=1e-5)
42+
assert torch.allclose(xxt_h, xxt, atol=1e-3)
4343

4444

4545
def test_kv_rotate():
@@ -59,7 +59,7 @@ def test_kv_rotate():
5959
},
6060
):
6161
output_test = model(dummy_input)
62-
assert torch.allclose(output_ref, output_test, atol=1e-5)
62+
assert torch.allclose(output_ref, output_test, atol=1e-3)
6363

6464
set_quantizer_by_cfg(
6565
model,

tests/gpu/torch/quantization/test_tensor_quant_cuda.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def _test_fp4_kernel(test_in, test_out):
231231
assert torch.allclose(quantized_outputs, expected_outputs)
232232
if triton_kernel.IS_AVAILABLE:
233233
quantized_outputs_triton = triton_kernel.fp4_fake_quant_block(
234-
inputs, inputs.abs().amax().item()
234+
inputs, inputs.abs().amax()
235235
)
236236
assert torch.allclose(quantized_outputs_triton, expected_outputs)
237237

0 commit comments

Comments
 (0)