Skip to content

Commit fb43fc8

Browse files
ShubhamladdhaShubham Laddha
andauthored
Upgrading onnx and onnxrt verions (#17655)
* Upgrading onnx and onnxrt verions Upgrading onnx and onnxrt verions Signed-off-by: Shubham Laddha <[email protected]> * Upgrading onnx and onnxrt verions Upgrading onnx and onnxrt verions Signed-off-by: Shubham Laddha <[email protected]> --------- Signed-off-by: Shubham Laddha <[email protected]> Co-authored-by: Shubham Laddha <[email protected]>
1 parent f4267d6 commit fb43fc8

File tree

2 files changed

+54
-24
lines changed

2 files changed

+54
-24
lines changed

docker/install/ubuntu_install_onnx.sh

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,41 @@ set -o pipefail
2626
# onnx 1.9 removed onnx optimizer from the main repo (see
2727
# https://github.com/onnx/onnx/pull/2834). When updating the CI image
2828
# to onnx>=1.9, onnxoptimizer should also be installed.
29-
pip3 install \
30-
onnx==1.12.0 \
31-
onnxruntime==1.12.1 \
32-
onnxoptimizer==0.2.7
3329

34-
# torch depends on a number of other packages, but unhelpfully, does
35-
# not expose that in the wheel!!!
30+
# Get the Python version
31+
PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
32+
33+
# Install the onnx package
3634
pip3 install future
3735

38-
pip3 install \
39-
torch==2.4.1 \
40-
torchvision==0.19.1 \
41-
--extra-index-url https://download.pytorch.org/whl/cpu
36+
if [ "$PYTHON_VERSION" == "3.9" ]; then
37+
pip3 install \
38+
onnx==1.16.0 \
39+
onnxruntime==1.19.2 \
40+
onnxoptimizer==0.2.7
41+
42+
pip3 install \
43+
torch==2.6.0 \
44+
torchvision==0.21.0 \
45+
--extra-index-url https://download.pytorch.org/whl/cpu
46+
elif [ "$PYTHON_VERSION" == "3.11" ]; then
47+
pip3 install \
48+
onnx==1.17.0 \
49+
onnxruntime==1.20.1 \
50+
onnxoptimizer==0.2.7
51+
52+
pip3 install \
53+
torch==2.6.0 \
54+
torchvision==0.21.0 \
55+
--extra-index-url https://download.pytorch.org/whl/cpu
56+
else
57+
pip3 install \
58+
onnx==1.12.0 \
59+
onnxruntime==1.12.1 \
60+
onnxoptimizer==0.2.7
61+
62+
pip3 install \
63+
torch==2.4.1 \
64+
torchvision==0.19.1 \
65+
--extra-index-url https://download.pytorch.org/whl/cpu
66+
fi

docker/install/ubuntu_install_python.sh

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ fi
3434
PYTHON_VERSION=$1
3535

3636
case "$PYTHON_VERSION" in
37-
3.7|3.8|3.9) ;;
37+
3.7|3.8|3.9|3.10|3.11) ;;
3838
*)
39-
echo "Only 3.7, 3.8, and 3.9 versions are supported in this script."
39+
echo "Only 3.7, 3.8, 3.9, 3.10 and 3.11 versions are supported in this script."
4040
exit -1
4141
;;
4242
esac
@@ -58,7 +58,10 @@ case "${release}" in
5858
[ "${PYTHON_VERSION}" == "3.7" ] && add-apt-repository -y ppa:deadsnakes/ppa
5959
;;
6060
jammy)
61-
if [ "${PYTHON_VERSION}" == "3.8" ] || [ "${PYTHON_VERSION}" == "3.9" ]; then
61+
if [ "${PYTHON_VERSION}" == "3.8" ] || \
62+
[ "${PYTHON_VERSION}" == "3.9" ] || \
63+
[ "${PYTHON_VERSION}" == "3.10" ] || \
64+
[ "${PYTHON_VERSION}" == "3.11" ]; then
6265
add-apt-repository -y ppa:deadsnakes/ppa
6366
fi
6467
;;
@@ -98,17 +101,19 @@ fi
98101

99102
# Update pip to match version used to produce requirements-hashed.txt. This step
100103
# is necessary so that pip's dependency solver is recent.
101-
pip_spec=$(tac /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt | grep -m 1 'pip==')
102-
${TVM_VENV}/bin/pip install -U --require-hashes -r <(echo "${pip_spec}") \
103-
-c /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt
104-
105-
# Python configuration
106-
${TVM_VENV}/bin/pip config set global.no-cache-dir true # Never cache packages
107-
108-
# Now install the remaining base packages.
109-
${TVM_VENV}/bin/pip install \
110-
--require-hashes \
111-
-r /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt
104+
if [ -f "/install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt" ]; then
105+
pip_spec=$(tac /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt | grep -m 1 'pip==')
106+
${TVM_VENV}/bin/pip install -U --require-hashes -r <(echo "${pip_spec}") \
107+
-c /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt
108+
109+
# Python configuration
110+
${TVM_VENV}/bin/pip config set global.no-cache-dir true # Never cache packages
111+
112+
# Now install the remaining base packages.
113+
${TVM_VENV}/bin/pip install \
114+
--require-hashes \
115+
-r /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt
116+
fi
112117

113118
addgroup tvm-venv
114119
chgrp -R tvm-venv "${TVM_VENV}"

0 commit comments

Comments
 (0)