Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
46 changes: 36 additions & 10 deletions docker/install/ubuntu_install_onnx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,42 @@ set -o pipefail
# onnx 1.9 removed onnx optimizer from the main repo (see
# https://github.com/onnx/onnx/pull/2834). When updating the CI image
# to onnx>=1.9, onnxoptimizer should also be installed.
pip3 install \
onnx==1.12.0 \
onnxruntime==1.12.1 \
onnxoptimizer==0.2.7

# torch depends on a number of other packages, but unhelpfully, does
# not expose that in the wheel!!!
# Get the Python version
PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")

# Install the onnx package
pip3 install future

pip3 install \
torch==2.4.1 \
torchvision==0.19.1 \
--extra-index-url https://download.pytorch.org/whl/cpu
if [ "$PYTHON_VERSION" == "3.9" ]; then
pip3 install \
onnx==1.16.0 \
onnxruntime==1.19.1 \
onnxoptimizer==0.2.7

pip3 install \
torch==2.6.0 \
torchvision==0.21.0 \
--extra-index-url https://download.pytorch.org/whl/cpu

elif [ "$PYTHON_VERSION" == "3.11" ]; then
pip3 install \
onnx==1.17.0 \
onnxruntime==1.20.1 \
onnxoptimizer==0.2.7

pip3 install \
torch==2.6.0 \
torchvision==0.21.0 \
--extra-index-url https://download.pytorch.org/whl/cpu
else
pip3 install \
onnx==1.12.0 \
onnxruntime==1.12.1 \
onnxoptimizer==0.2.7

pip3 install \
torch==2.4.1 \
torchvision==0.19.1 \
--extra-index-url https://download.pytorch.org/whl/cpu
fi
33 changes: 19 additions & 14 deletions docker/install/ubuntu_install_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ fi
PYTHON_VERSION=$1

case "$PYTHON_VERSION" in
3.7|3.8|3.9) ;;
3.7|3.8|3.9|3.10|3.11) ;;
*)
echo "Only 3.7, 3.8, and 3.9 versions are supported in this script."
echo "Only 3.7, 3.8, 3.9, 3.10 and 3.11 versions are supported in this script."
exit -1
;;
esac
Expand All @@ -58,7 +58,10 @@ case "${release}" in
[ "${PYTHON_VERSION}" == "3.7" ] && add-apt-repository -y ppa:deadsnakes/ppa
;;
jammy)
if [ "${PYTHON_VERSION}" == "3.8" ] || [ "${PYTHON_VERSION}" == "3.9" ]; then
if [ "${PYTHON_VERSION}" == "3.8" ] || \
[ "${PYTHON_VERSION}" == "3.9" ] || \
[ "${PYTHON_VERSION}" == "3.10" ] || \
[ "${PYTHON_VERSION}" == "3.11" ]; then
add-apt-repository -y ppa:deadsnakes/ppa
fi
;;
Expand Down Expand Up @@ -98,17 +101,19 @@ fi

# Update pip to match version used to produce requirements-hashed.txt. This step
# is necessary so that pip's dependency solver is recent.
pip_spec=$(tac /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt | grep -m 1 'pip==')
${TVM_VENV}/bin/pip install -U --require-hashes -r <(echo "${pip_spec}") \
-c /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt

# Python configuration
${TVM_VENV}/bin/pip config set global.no-cache-dir true # Never cache packages

# Now install the remaining base packages.
${TVM_VENV}/bin/pip install \
--require-hashes \
-r /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt
if [ -f "/install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt" ]; then
pip_spec=$(tac /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt | grep -m 1 'pip==')
${TVM_VENV}/bin/pip install -U --require-hashes -r <(echo "${pip_spec}") \
-c /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt

# Python configuration
${TVM_VENV}/bin/pip config set global.no-cache-dir true # Never cache packages

# Now install the remaining base packages.
${TVM_VENV}/bin/pip install \
--require-hashes \
-r /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt
fi

addgroup tvm-venv
chgrp -R tvm-venv "${TVM_VENV}"
Expand Down