1
1
[tox]
2
2
envlist =
3
3
pre-commit-all
4
- py312-torch27- unit
4
+ py312-torch28-{ unit,gpu}
5
5
skipsdist = True
6
6
toxworkdir = /tmp/{env:USER}-modelopt-tox
7
7
8
8
9
9
# ###########################
10
10
# CPU Unit test environments
11
11
# ###########################
12
- [testenv:{py39,py310,py311,py312}-torch{24, 25,26,27}-unit]
12
+ [testenv:{py39,py310,py311,py312}-torch{25,26,27,28 }-unit]
13
13
deps =
14
+ # Build onnxsim from sdists for Python 3.12 until http://github.com/daquexian/onnx-simplifier/pull/353
15
+ py312: onnxsim
16
+
14
17
# torch version auto-selected based on torchvision version
15
- torch24: torchvision~=0.19.0
16
18
torch25: torchvision~=0.20.0
17
19
torch26: torchvision~=0.21.0
18
20
torch27: torchvision~=0.22.0
21
+ torch28: torchvision~=0.23.0
19
22
20
23
-e .[all,dev-test]
21
24
commands =
22
25
python -m pytest tests/unit --cov
23
26
24
27
28
+ # ####################################################################
29
+ # Environment to run unit tests with subset of dependencies installed
30
+ # ####################################################################
31
+ [testenv:{py39,py310,py311,py312}-ext-unit-{onnx,torch,torch_deploy}]
32
+ allowlist_externals =
33
+ bash, rm
34
+ deps =
35
+ # Build onnxsim from sdists for Python 3.12 until http://github.com/daquexian/onnx-simplifier/pull/353
36
+ py312: onnxsim
37
+
38
+ # ONNX unit tests heavily rely on torch / torchvision
39
+ onnx: .[onnx,dev-test]
40
+ onnx: torchvision
41
+
42
+ # Install megatron-core to test torch-only install can still import plugins
43
+ torch: megatron-core
44
+ torch: .[dev-test]
45
+
46
+ torch_deploy: .[onnx,torch,dev-test]
47
+ commands =
48
+ onnx: python -m pytest tests/unit/onnx
49
+ torch: python -m pytest tests/unit/torch --ignore tests/unit/torch/deploy
50
+ torch_deploy: python -m pytest tests/unit/torch/deploy
51
+
52
+
53
+ # #######################################################
54
+ # GPU test environments (Can be used with --current-env)
55
+ # #######################################################
56
+ [testenv:{py39,py310,py311,py312}-cuda12-gpu]
57
+ commands_pre =
58
+ # Install deps here so that it gets installed even in --current-env
59
+ pip install -U megatron-core
60
+ pip install git+https://github.com/Dao-AILab/fast-hadamard-transform.git
61
+
62
+ # Install Eagle-3 test dependencies
63
+ pip install tiktoken blobfile sentencepiece
64
+
65
+ # Build onnxsim from sdists for Python 3.12 until http://github.com/daquexian/onnx-simplifier/pull/353
66
+ py312: pip install onnxsim
67
+
68
+ # NOTE: User is expected to have correct torch-cuda version pre-installed if using --current-env
69
+ # to avoid possible CUDA version mismatch
70
+ pip install -e .[all,dev-test]
71
+ commands =
72
+ # Coverage fails with "Can't combine line data with arc data" error so not using "--cov"
73
+ python -m pytest tests/gpu
74
+
25
75
# ############################################
26
76
# Code quality checks on all files or on diff
27
77
# ############################################
@@ -33,9 +83,9 @@ commands =
33
83
diff: pre-commit run --from-ref origin/main --to-ref HEAD {posargs}
34
84
35
85
36
- # ####################
37
- # Documentation build
38
- # ####################
86
+ # ########################
87
+ # Run documentation build
88
+ # ########################
39
89
[testenv:{build,debug}-docs]
40
90
allowlist_externals =
41
91
rm
@@ -50,3 +100,26 @@ commands_pre =
50
100
commands =
51
101
sphinx-build source build/html --fail-on-warning --show-traceback --keep-going
52
102
debug: sphinx-autobuild source build/html --host 0.0.0.0
103
+
104
+
105
+ # ################
106
+ # Run wheel build
107
+ # ################
108
+ [testenv:build-wheel]
109
+ allowlist_externals =
110
+ bash, cd, rm
111
+ passenv =
112
+ SETUPTOOLS_SCM_PRETEND_VERSION
113
+ deps =
114
+ twine
115
+ commands =
116
+ # Clean build directory to avoid any stale files getting into the wheel
117
+ rm -rf build
118
+
119
+ # Build and check wheel
120
+ pip wheel --no-deps --wheel-dir =dist .
121
+ twine check dist/*
122
+
123
+ # Install and test the wheel
124
+ bash -c " find dist -name 'nvidia_modelopt-*.whl' | xargs pip install -f dist"
125
+ bash -c " cd dist; python -c 'import modelopt; print(modelopt.__version__);'"
0 commit comments