@@ -71,6 +71,22 @@ mkdir -p ${MODELS_WEIGHT_DIR}
7171# # Make sure we have up-to-date pip and wheel
7272pip3 install -U pip wheel
7373
74+ if [ " ${CUDA_VERSION} " == " " ] && [ " ${CPU} " == " False" ]; then
75+ CUDA_VERSION=$( nvcc --version | sed -n ' s/^.*release \([0-9]\+\.[0-9]\+\).*$/\1/p' )
76+ if [ ${CUDA_VERSION} == " " ]; then
77+ echo " error with cuda, check your system, source env_cuda.sh or specify cuda version as argument."
78+ fi
79+ fi
80+ if [ -z " $CUDA_VERSION " ] || [ " $CPU " == " True" ]; then
81+ echo " installing on cpu"
82+ pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
83+ wait
84+ else
85+ echo " cuda version: $CUDA_VERSION "
86+ pip3 install torch==${TORCH_VERSION} +cu${CUDA_VERSION// ./ } torchvision==${TORCHVISION_VERSION} +cu${CUDA_VERSION// ./ } --extra-index-url https://download.pytorch.org/whl/cu${CUDA_VERSION// ./ }
87+ wait
88+ fi
89+
7490# # Detectron2
7591if [ " ${MODEL,,} " == " detectron2" ] || [ ${MODEL} == " all" ]; then
7692
@@ -89,22 +105,6 @@ if [ "${MODEL,,}" == "detectron2" ] || [ ${MODEL} == "all" ]; then
89105 echo
90106 git -c advice.detachedHead=false checkout 175b2453c2bc4227b8039118c01494ee75b08136
91107
92- if [ " ${CUDA_VERSION} " == " " ] && [ " ${CPU} " == " False" ]; then
93- CUDA_VERSION=$( nvcc --version | sed -n ' s/^.*release \([0-9]\+\.[0-9]\+\).*$/\1/p' )
94- if [ ${CUDA_VERSION} == " " ]; then
95- echo " error with cuda, check your system, source env_cuda.sh or specify cuda version as argument."
96- fi
97- fi
98- if [ -z " $CUDA_VERSION " ] || [ " $CPU " == " True" ]; then
99- echo " installing on cpu"
100- pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
101- wait
102- else
103- echo " cuda version: $CUDA_VERSION "
104- pip3 install torch==${TORCH_VERSION} +cu${CUDA_VERSION// ./ } torchvision==${TORCHVISION_VERSION} +cu${CUDA_VERSION// ./ } --extra-index-url https://download.pytorch.org/whl/cu${CUDA_VERSION// ./ }
105- wait
106- fi
107-
108108 # '!' egating set -e when patching has been applied already
109109 ! patch -p1 --forward < ${SCRIPT_DIR} /0001-detectron2-fpn-bottom-up-separate.patch
110110
0 commit comments