Skip to content

Commit b143cf8

Browse files
authored
Merge branch 'main' into models/replace_se
2 parents b04fa9a + b5d81f0 commit b143cf8

26 files changed

+357
-111
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.circleci/config.yml.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,12 @@ jobs:
763763
paths:
764764
- conda
765765
- env
766+
- run:
767+
name: Install CUDA
768+
command: packaging/windows/internal/cuda_install.bat
769+
- run:
770+
name: Update CUDA driver
771+
command: packaging/windows/internal/driver_update.bat
766772
- run:
767773
name: Install torchvision
768774
command: .circleci/unittest/windows/scripts/install.sh

.circleci/unittest/windows/scripts/install.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ unset PYTORCH_VERSION
55
# so no need to set PYTORCH_VERSION.
66
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.
77

8-
set -e
8+
set -ex
99

1010
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1111

@@ -35,5 +35,17 @@ if [ $PYTHON_VERSION == "3.6" ]; then
3535
pip install pillow>=5.3.0
3636
fi
3737

38+
torch_cuda=$(python -c "import torch; print(torch.cuda.is_available())")
39+
echo torch.cuda.is_available is $torch_cuda
40+
41+
if [ ! -z "${CUDA_VERSION:-}" ] ; then
42+
if [ "$torch_cuda" == "False" ]; then
43+
echo "torch with cuda installed but torch.cuda.is_available() is False"
44+
exit 1
45+
fi
46+
fi
47+
48+
source "$this_dir/set_cuda_envs.sh"
49+
3850
printf "* Installing torchvision\n"
3951
"$this_dir/vc_env_helper.bat" python setup.py develop

.circleci/unittest/windows/scripts/run_test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ set -e
55
eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
66
conda activate ./env
77

8+
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9+
source "$this_dir/set_cuda_envs.sh"
10+
811
export PYTORCH_TEST_WITH_SLOW='1'
912
python -m torch.utils.collect_env
1013
pytest --cov=torchvision --junitxml=test-results/junit.xml -v --durations 20 test --ignore=test/test_datasets_download.py
Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
#!/usr/bin/env bash
2+
set -ex
23

3-
if [ "${CU_VERSION:-}" == "cpu" ] ; then
4-
exit 0
5-
fi
4+
echo CU_VERSION is "${CU_VERSION}"
5+
echo CUDA_VERSION is "${CUDA_VERSION}"
66

7-
if [[ ${#CU_VERSION} -eq 5 ]]; then
8-
CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}"
7+
# Currenly, CU_VERSION and CUDA_VERSION are not consistent.
8+
# to understand this code, see https://github.com/pytorch/vision/issues/4443
9+
version="cpu"
10+
if [[ ! -z "${CUDA_VERSION}" ]] ; then
11+
version="$CUDA_VERSION"
12+
else
13+
if [[ ${#CU_VERSION} -eq 5 ]]; then
14+
version="${CU_VERSION:2:2}.${CU_VERSION:4:1}"
15+
fi
916
fi
1017

11-
# It's a log to see if CU_VERSION exists, if not, we use environment CUDA_VERSION directly
12-
# in unittest_windows_gpu, there's no CU_VERSION, but CUDA_VERSION.
13-
echo "Using CUDA $CUDA_VERSION, CU_VERSION is $CU_VERSION now"
18+
# Don't use if [[ "$version" == "cpu" ]]; then exit 0 fi.
19+
# It would exit the shell. One result is cpu tests would not run if the shell exit.
20+
# Unless there's an error, Don't exit.
21+
if [[ "$version" != "cpu" ]]; then
22+
# set cuda envs
23+
export PATH="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/libnvvp:$PATH"
24+
export CUDA_PATH_V${version/./_}="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}"
25+
export CUDA_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}"
1426

15-
version=$CUDA_VERSION
27+
if [ ! -d "$CUDA_PATH" ]; then
28+
echo "$CUDA_PATH" does not exist
29+
exit 1
30+
fi
1631

17-
# set cuda envs
18-
export PATH="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/libnvvp:$PATH"
19-
export CUDA_PATH_V${version/./_}="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}"
20-
export CUDA_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}"
32+
if [ ! -f "${CUDA_PATH}\include\nvjpeg.h" ]; then
33+
echo "nvjpeg does not exist"
34+
exit 1
35+
fi
2136

22-
if [ ! -d "$CUDA_PATH" ]
23-
then
24-
echo "$CUDA_PATH" does not exist
25-
exit 1
26-
fi
37+
# check cuda driver version
38+
for path in '/c/Program Files/NVIDIA Corporation/NVSMI/nvidia-smi.exe' /c/Windows/System32/nvidia-smi.exe; do
39+
if [[ -x "$path" ]]; then
40+
"$path" || echo "true";
41+
break
42+
fi
43+
done
2744

28-
# check cuda driver version
29-
for path in '/c/Program Files/NVIDIA Corporation/NVSMI/nvidia-smi.exe' /c/Windows/System32/nvidia-smi.exe; do
30-
if [[ -x "$path" ]]; then
31-
"$path" || echo "true";
32-
break
33-
fi
34-
done
35-
which nvcc
45+
which nvcc
46+
nvcc --version
47+
env | grep CUDA
48+
fi

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ otherwise, add the include and library paths in the environment variables ``TORC
106106
.. _libjpeg: http://ijg.org/
107107
.. _libjpeg-turbo: https://libjpeg-turbo.org/
108108

109+
Video Backend
110+
=============
111+
Torchvision currently supports the following video backends:
112+
113+
* [pyav](https://github.com/PyAV-Org/PyAV) (default) - Pythonic binding for ffmpeg libraries.
114+
115+
* video_reader - This needs ffmpeg to be installed and torchvision to be built from source. There shouldn't be any conflicting version of ffmpeg installed. Currently, this is only supported on Linux.
116+
117+
.. code:: bash
118+
119+
conda install -c conda-forge ffmpeg
120+
python setup.py install
121+
122+
109123
Using the models on C++
110124
=======================
111125
TorchVision provides an example project for how to use the models on C++ using JIT Script.

docs/source/ops.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _ops:
2+
13
torchvision.ops
24
===============
35

docs/source/utils.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _utils:
2+
13
torchvision.utils
24
=================
35

gallery/assets/FudanPed00054.png

309 KB
Loading

gallery/assets/FudanPed00054_mask.png

2.3 KB
Loading

0 commit comments

Comments
 (0)