Skip to content
Merged
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/gpu_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ name: GPU tests
on:
push:
branches: ["pull-request/[0-9]+"]
paths:
- ".github/workflows/gpu_tests.yml"
- "modelopt/**"
- "tests/**"
- "setup.py"
- "tox.ini"
# TODO: paths cannot be used since push happens to copied PR and only latest commit to PR is used
# paths:
# - ".github/workflows/gpu_tests.yml"
# - "modelopt/**"
# - "tests/gpu/**"
# - "setup.py"
# - "tox.ini"

# Cancel previous runs if new commit is pushed to the same PR
concurrency:
Expand All @@ -28,7 +29,7 @@ jobs:
PIP_CONSTRAINT: "" # Disable pip constraint for upgrading packages
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pip install tox-current-env
- name: Setup proxy cache
uses: nv-gha-runners/setup-proxy-cache@main
- name: Run gpu tests
run: tox -e py312-cuda12-gpu --current-env
run: pip install tox-current-env && tox -e py312-cuda12-gpu --current-env
10 changes: 3 additions & 7 deletions .github/workflows/multi_version_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
paths:
- ".github/workflows/multi_version_unit_tests.yml"
- "modelopt/**"
- "tests/**"
- "tests/unit/**"
- "setup.py"
- "tox.ini"

Expand All @@ -28,10 +28,8 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.${{ matrix.py }}"
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e py3${{ matrix.py }}-torch28-unit
run: pip install tox && tox -e py3${{ matrix.py }}-torch28-unit
multi-torch-unit:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand All @@ -43,7 +41,5 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e py312-torch${{ matrix.torch }}-unit
run: pip install tox && tox -e py312-torch${{ matrix.torch }}-unit
6 changes: 2 additions & 4 deletions .github/workflows/partial_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths:
- ".github/workflows/partial_unit_tests.yml"
- "modelopt/**"
- "tests/**"
- "tests/unit/**"
- "setup.py"
- "tox.ini"

Expand All @@ -27,7 +27,5 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e py312-partial-unit-${{ matrix.test-env }}
run: pip install tox && tox -e py312-partial-unit-${{ matrix.test-env }}
27 changes: 19 additions & 8 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths:
- ".github/workflows/unit_tests.yml"
- "modelopt/**"
- "tests/**"
- "tests/unit/**"
- "setup.py"
- "tox.ini"

Expand All @@ -17,17 +17,28 @@ concurrency:

jobs:
unit-tests:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e py312-torch28-unit
run: pip install tox && COV_ARGS="--cov" tox -e py312-torch28-unit
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
unit-tests-windows:
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run unit tests (without coverage)
run: pip install tox && tox -e py312-torch28-unit
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![Documentation](https://img.shields.io/badge/Documentation-latest-brightgreen.svg?style=flat)](https://nvidia.github.io/TensorRT-Model-Optimizer)
[![version](https://img.shields.io/pypi/v/nvidia-modelopt?label=Release)](https://pypi.org/project/nvidia-modelopt/)
[![license](https://img.shields.io/badge/License-Apache%202.0-blue)](./LICENSE)
[![codecov](https://codecov.io/github/NVIDIA/TensorRT-Model-Optimizer/graph/badge.svg?token=r1bw4LC1WH)](https://codecov.io/github/NVIDIA/TensorRT-Model-Optimizer)

[Examples](#examples) |
[Documentation](https://nvidia.github.io/TensorRT-Model-Optimizer) |
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ extend-ignore = [
"PLR0402", "PLR0912", "PLR0913", "PLR0915", "PLR2004", "PLR0911",
"PT011", "PT018",
"RUF002", "RUF012",
"SIM115",
"UP038", "UP032",
"SIM108", "SIM102",
"SIM102", "SIM108", "SIM115",
"UP032", "UP038",
]


Expand Down Expand Up @@ -120,7 +119,7 @@ markers = ["manual: Only run when --run-manual is given"]

[tool.coverage.run]
# measure branch coverage in addition to statement coverage
branch = true
branch = false
include = ["modelopt/*"]
omit = ["*/plugins/*", "*/export/*"]

Expand Down
4 changes: 2 additions & 2 deletions tests/gpu/torch/quantization/test_hadamard.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_hadamard_transform(dim):
xxt = x @ x.T
x_h = normalized_hadamard_transform(x)
xxt_h = x_h @ x_h.T
assert torch.allclose(xxt_h, xxt, atol=1e-5)
assert torch.allclose(xxt_h, xxt, atol=1e-3)


def test_kv_rotate():
Expand All @@ -59,7 +59,7 @@ def test_kv_rotate():
},
):
output_test = model(dummy_input)
assert torch.allclose(output_ref, output_test, atol=1e-5)
assert torch.allclose(output_ref, output_test, atol=1e-3)

set_quantizer_by_cfg(
model,
Expand Down
2 changes: 1 addition & 1 deletion tests/gpu/torch/quantization/test_tensor_quant_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _test_fp4_kernel(test_in, test_out):
assert torch.allclose(quantized_outputs, expected_outputs)
if triton_kernel.IS_AVAILABLE:
quantized_outputs_triton = triton_kernel.fp4_fake_quant_block(
inputs, inputs.abs().amax().item()
inputs, inputs.abs().amax()
)
assert torch.allclose(quantized_outputs_triton, expected_outputs)

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ deps =

-e .[all,dev-test]
commands =
python -m pytest tests/unit --cov
python -m pytest tests/unit {env:COV_ARGS:}


#####################################################################
Expand Down
Loading