Skip to content

Commit cdefc19

Browse files
ci: Adding tests for numpy>=2 (#7756)
Co-authored-by: Ryan McCormick <[email protected]>
1 parent 58fe34d commit cdefc19

File tree

1 file changed

+21
-2
lines changed
  • qa/L0_backend_python/examples

1 file changed

+21
-2
lines changed

qa/L0_backend_python/examples/test.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,29 @@ rm -fr *.log python_backend/
3838

3939
# Install torch
4040
pip3 uninstall -y torch
41+
pip3 uninstall -y numpy
42+
# NOTE: Using this subtest as a test case that involves using a python model with
43+
# numpy 2.X without changing the environments used in all the other test cases.
4144
if [ "$TEST_JETSON" == "0" ] && [[ ${TEST_WINDOWS} == 0 ]]; then
42-
pip3 install torch==2.0.0+cu117 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.15.0+cu117
45+
if [ ${PYTHON_ENV_VERSION} == "8" ]; then
46+
# Python 3.8 does not support numpy 2.x, so installing numpy1.x
47+
pip3 install "numpy<2"
48+
pip3 install torch==2.0.0+cu117 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.15.0+cu117
49+
else
50+
# Python 3.9 >= supports numpy 2.x.
51+
pip3 install "numpy>=2"
52+
pip3 install torch==2.5.0 torchvision==0.20.0 --index-url https://download.pytorch.org/whl/cu124
53+
fi
4354
else
44-
pip3 install torch==2.0.0 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.15.0
55+
if [ ${PYTHON_ENV_VERSION} == "8" ]; then
56+
# Python 3.8 does not support numpy 2.x, so installing numpy1.x
57+
pip3 install "numpy<2"
58+
pip3 install torch==2.0.0 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.15.0
59+
else
60+
# Python 3.9 >= supports numpy 2.x.
61+
pip3 install "numpy>=2"
62+
pip3 install torch==2.5.0 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.20.0
63+
fi
4564
fi
4665

4766
# Install `validators` for Model Instance Kind example

0 commit comments

Comments
 (0)