Skip to content

Commit f1f2e45

Browse files
authored
Merge branch 'master' into bugfix/nms_oveflow_fp16
2 parents cd9bc45 + af97ec2 commit f1f2e45

File tree

23 files changed

+1070
-393
lines changed

23 files changed

+1070
-393
lines changed

.circleci/config.yml

Lines changed: 889 additions & 347 deletions
Large diffs are not rendered by default.

.circleci/config.yml.in

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ binary_common: &binary_common
7373
description: "Wheel only: what docker image to use"
7474
type: string
7575
default: "pytorch/manylinux-cuda101"
76+
conda_docker_image:
77+
description: "Conda only: what docker image to use"
78+
type: string
79+
default: "pytorch/conda-builder:cpu"
7680
environment:
7781
PYTHON_VERSION: << parameters.python_version >>
7882
PYTORCH_VERSION: << parameters.pytorch_version >>
@@ -189,7 +193,7 @@ jobs:
189193
binary_linux_conda:
190194
<<: *binary_common
191195
docker:
192-
- image: "pytorch/conda-cuda"
196+
- image: "<< parameters.conda_docker_image >>"
193197
resource_class: 2xlarge+
194198
steps:
195199
- checkout_merge
@@ -411,7 +415,11 @@ jobs:
411415
set -x
412416
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
413417
conda env remove -n python${PYTHON_VERSION} || true
414-
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
418+
CONDA_CHANNEL_FLAGS=""
419+
if [[ "${PYTHON_VERSION}" = 3.9 ]]; then
420+
CONDA_CHANNEL_FLAGS="-c=conda-forge"
421+
fi
422+
conda create ${CONDA_CHANNEL_FLAGS} -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
415423
conda activate python${PYTHON_VERSION}
416424
conda install Pillow
417425
conda install -v -y -c pytorch-nightly pytorch
@@ -436,7 +444,11 @@ jobs:
436444
command: |
437445
set -x
438446
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
439-
conda env remove -n python${PYTHON_VERSION} || true
447+
CONDA_CHANNEL_FLAGS=""
448+
if [[ "${PYTHON_VERSION}" = 3.9 ]]; then
449+
CONDA_CHANNEL_FLAGS="-c=conda-forge"
450+
fi
451+
conda create ${CONDA_CHANNEL_FLAGS} -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
440452
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
441453
conda activate python${PYTHON_VERSION}
442454
pip install $(ls ~/workspace/torchvision*.whl) --pre -f https://download.pytorch.org/whl/nightly/torch_nightly.html
@@ -513,7 +525,7 @@ jobs:
513525
- env
514526
- run:
515527
name: Install torchvision
516-
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL "${image_name}" .circleci/unittest/linux/scripts/install.sh
528+
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
517529
- run:
518530
name: Run tests
519531
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh

.circleci/regenerate.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@
1919
import os.path
2020

2121

22-
PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
22+
PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
23+
CUDA_VERSION = ["10.1", "10.2", "11.2"]
2324

2425

2526
def build_workflows(prefix='', filter_branch=None, upload=False, indentation=6, windows_latest_only=False):
2627
w = []
2728
for btype in ["wheel", "conda"]:
2829
for os_type in ["linux", "macos", "win"]:
2930
python_versions = PYTHON_VERSIONS
30-
cu_versions_dict = {"linux": ["cpu", "cu92", "cu101", "cu102", "cu110"],
31-
"win": ["cpu", "cu101", "cu102", "cu110"],
31+
cu_versions_dict = {"linux": ["cpu", "cu101", "cu102", "cu112"],
32+
"win": ["cpu", "cu101", "cu102", "cu112"],
3233
"macos": ["cpu"]}
3334
cu_versions = cu_versions_dict[os_type]
3435
for python_version in python_versions:
@@ -99,6 +100,7 @@ def upload_doc_job(filter_branch):
99100
"cu101": "pytorch/manylinux-cuda101",
100101
"cu102": "pytorch/manylinux-cuda102",
101102
"cu110": "pytorch/manylinux-cuda110",
103+
"cu112": "pytorch/manylinux-cuda112",
102104
}
103105

104106

@@ -109,6 +111,14 @@ def get_manylinux_image(cu_version):
109111
return f"pytorch/manylinux-cuda{cu_suffix}"
110112

111113

114+
def get_conda_image(cu_version):
115+
if cu_version == "cpu":
116+
return "pytorch/conda-builder:cpu"
117+
if cu_version.startswith('cu'):
118+
cu_suffix = cu_version[len('cu'):]
119+
return f"pytorch/conda-builder:cuda{cu_suffix}"
120+
121+
112122
def generate_base_workflow(base_workflow_name, python_version, cu_version,
113123
unicode, os_type, btype, *, filter_branch=None):
114124

@@ -123,6 +133,7 @@ def generate_base_workflow(base_workflow_name, python_version, cu_version,
123133

124134
if os_type != "win":
125135
d["wheel_docker_image"] = get_manylinux_image(cu_version)
136+
d["conda_docker_image"] = get_conda_image(cu_version)
126137

127138
if filter_branch is not None:
128139
d["filters"] = {

.circleci/unittest/linux/scripts/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
channels:
22
- pytorch
33
- defaults
4+
# using conda-forge for python v3.9+
5+
- conda-forge
46
dependencies:
5-
- numpy
67
- pytest
78
- pytest-cov
89
- codecov
910
- pip
1011
- libpng
1112
- jpeg
12-
- ffmpeg=4.2
1313
- ca-certificates
1414
- pip:
1515
- future

.circleci/unittest/linux/scripts/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ else
2222
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
2323
cudatoolkit="cudatoolkit=${version}"
2424
fi
25+
2526
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
26-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}"
27+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge pytorch "${cudatoolkit}"
2728

2829
printf "* Installing torchvision\n"
2930
python setup.py develop

.circleci/unittest/linux/scripts/setup_env.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,13 @@ conda activate "${env_dir}"
3636

3737
# 3. Install Conda dependencies
3838
printf "* Installing dependencies (except PyTorch)\n"
39+
NUMPY_MIN_VER="1.11"
40+
FFMPEG_PIN="=4.2"
41+
if [[ "${PYTHON_VERSION}" = "3.9" ]]; then
42+
NUMPY_MIN_VER="1.20"
43+
FFMPEG_PIN=">=4.2"
44+
fi
45+
46+
conda install -y -c conda-forge "numpy >=${NUMPY_MIN_VER}"
47+
conda install -y -c pytorch "ffmpeg${FFMPEG_PIN}"
3948
conda env update --file "${this_dir}/environment.yml" --prune

.circleci/unittest/windows/scripts/environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
channels:
22
- pytorch
33
- defaults
4+
# use conda-forge for python v3.9+
5+
- conda-forge
46
dependencies:
5-
- numpy
67
- pytest
78
- pytest-cov
89
- codecov

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ else
2424
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
2525
cudatoolkit="cudatoolkit=${version}"
2626
fi
27+
2728
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
28-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}"
29+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge pytorch "${cudatoolkit}"
2930

3031
printf "* Installing torchvision\n"
3132
"$this_dir/vc_env_helper.bat" python setup.py develop

.circleci/unittest/windows/scripts/setup_env.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ conda activate "${env_dir}"
3636

3737
# 3. Install Conda dependencies
3838
printf "* Installing dependencies (except PyTorch)\n"
39+
NUMPY_MIN_VER="1.11"
40+
if [[ "${PYTHON_VERSION}" = "3.9" ]]; then
41+
NUMPY_MIN_VER="1.20"
42+
fi
43+
conda install -y -c conda-forge "numpy >=${NUMPY_MIN_VER}"
3944
conda env update --file "${this_dir}/environment.yml" --prune

packaging/pkg_helpers.bash

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ setup_cuda() {
4949

5050
# Now work out the CUDA settings
5151
case "$CU_VERSION" in
52+
cu112)
53+
if [[ "$OSTYPE" == "msys" ]]; then
54+
export CUDA_HOME="C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.2"
55+
else
56+
export CUDA_HOME=/usr/local/cuda-11.2/
57+
fi
58+
export FORCE_CUDA=1
59+
# Hard-coding gencode flags is temporary situation until
60+
# https://github.com/pytorch/pytorch/pull/23408 lands
61+
export NVCC_FLAGS="-gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_50,code=compute_50"
62+
;;
5263
cu110)
5364
if [[ "$OSTYPE" == "msys" ]]; then
5465
export CUDA_HOME="C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.0"
@@ -170,10 +181,13 @@ setup_wheel_python() {
170181
if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
171182
eval "$(conda shell.bash hook)"
172183
conda env remove -n "env$PYTHON_VERSION" || true
173-
conda create -yn "env$PYTHON_VERSION" python="$PYTHON_VERSION"
184+
if [[ "$PYTHON_VERSION" == 3.9 ]]; then
185+
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c=conda-forge"
186+
fi
187+
conda create ${CONDA_CHANNEL_FLAGS} -yn "env$PYTHON_VERSION" python="$PYTHON_VERSION"
174188
conda activate "env$PYTHON_VERSION"
175189
# Install libpng from Anaconda (defaults)
176-
conda install libpng jpeg -y
190+
conda install ${CONDA_CHANNEL_FLAGS} -c conda-forge libpng "jpeg<=9b" -y
177191
else
178192
# Install native CentOS libJPEG, LAME, freetype and GnuTLS
179193
yum install -y libjpeg-turbo-devel lame freetype gnutls
@@ -189,6 +203,7 @@ setup_wheel_python() {
189203
3.6) python_abi=cp36-cp36m ;;
190204
3.7) python_abi=cp37-cp37m ;;
191205
3.8) python_abi=cp38-cp38 ;;
206+
3.9) python_abi=cp39-cp39 ;;
192207
*)
193208
echo "Unrecognized PYTHON_VERSION=$PYTHON_VERSION"
194209
exit 1
@@ -263,6 +278,9 @@ setup_conda_pytorch_constraint() {
263278
if [[ "$OSTYPE" == msys && "$CU_VERSION" == cu92 ]]; then
264279
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c defaults -c numba/label/dev"
265280
fi
281+
if [[ "$PYTHON_VERSION" == 3.9 ]]; then
282+
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c=conda-forge"
283+
fi
266284
}
267285

268286
# Translate CUDA_VERSION into CUDA_CUDATOOLKIT_CONSTRAINT
@@ -272,6 +290,9 @@ setup_conda_cudatoolkit_constraint() {
272290
export CONDA_CUDATOOLKIT_CONSTRAINT=""
273291
else
274292
case "$CU_VERSION" in
293+
cu112)
294+
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.2,<11.3 # [not osx]"
295+
;;
275296
cu110)
276297
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.0,<11.1 # [not osx]"
277298
;;
@@ -307,6 +328,9 @@ setup_conda_cudatoolkit_plain_constraint() {
307328
export CMAKE_USE_CUDA=0
308329
else
309330
case "$CU_VERSION" in
331+
cu112)
332+
export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit=11.2"
333+
;;
310334
cu102)
311335
export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit=10.2"
312336
;;

0 commit comments

Comments
 (0)