-
Notifications
You must be signed in to change notification settings - Fork 362
/
Copy pathpre_build_script_windows.sh
46 lines (35 loc) · 2.22 KB
/
pre_build_script_windows.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
set -x
pip install -U numpy packaging pyyaml setuptools wheel
choco install bazelisk -y
echo TENSORRT_VERSION=${TENSORRT_VERSION}
if [[ ${TENSORRT_VERSION} != "" ]]; then
# Replace dependencies in the original pyproject.toml with the current TensorRT version. It is used for CI tests of different TensorRT versions.
# For example, if the current testing TensorRT version is 10.7.0, but the pyproject.toml tensorrt>=10.8.0,<10.9.0, then the following sed command
# will replace tensorrt>=10.8.0,<10.9.0 with tensorrt==10.7.0
sed -i -e "s/tensorrt>=.*,<.*\"/tensorrt>=${TENSORRT_VERSION},<$(echo "${TENSORRT_VERSION}" | awk -F. '{print $1"."$2+1".0"}')\"/g" \
-e "s/tensorrt-cu12>=.*,<.*\"/tensorrt-cu12>=${TENSORRT_VERSION},<$(echo "${TENSORRT_VERSION}" | awk -F. '{print $1"."$2+1".0"}')\"/g" \
-e "s/tensorrt-cu12-bindings>=.*,<.*\"/tensorrt-cu12-bindings>=${TENSORRT_VERSION},<$(echo "${TENSORRT_VERSION}" | awk -F. '{print $1"."$2+1".0"}')\"/g" \
-e "s/tensorrt-cu12-libs>=.*,<.*\"/tensorrt-cu12-libs>=${TENSORRT_VERSION},<$(echo "${TENSORRT_VERSION}" | awk -F. '{print $1"."$2+1".0"}')\"/g" \
pyproject.toml
fi
if [[ "${CU_VERSION::4}" < "cu12" ]]; then
# replace dependencies from tensorrt-cu12-bindings/libs to tensorrt-cu11-bindings/libs
sed -i -e "s/tensorrt-cu12/tensorrt-${CU_VERSION::4}/g" \
-e "s/tensorrt-cu12-bindings/tensorrt-${CU_VERSION::4}-bindings/g" \
-e "s/tensorrt-cu12-libs/tensorrt-${CU_VERSION::4}-libs/g" \
pyproject.toml
fi
TORCH_TORCHVISION=$(grep "^torch" py/requirements.txt)
INDEX_URL=https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}
# Install all the dependencies required for Torch-TensorRT
pip uninstall -y torch torchvision
pip install --force-reinstall --pre ${TORCH_TORCHVISION} --index-url ${INDEX_URL}
export CUDA_HOME="$(echo ${CUDA_PATH} | sed -e 's#\\#\/#g')"
export TORCH_INSTALL_PATH="$(python -c "import torch, os; print(os.path.dirname(torch.__file__))" | sed -e 's#\\#\/#g')"
if [[ ${TENSORRT_VERSION} != "" ]]; then
cat toolchains/ci_workspaces/MODULE_tensorrt.bazel.tmpl | envsubst > MODULE.bazel
else
cat toolchains/ci_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel
fi
cat MODULE.bazel
echo "RELEASE=1" >> ${GITHUB_ENV}