Skip to content

Commit 59286fa

Browse files
authored
Merge branch 'main' into prabhat00155/fix_shape_error
2 parents 085cb9e + 781b0f9 commit 59286fa

File tree

263 files changed

+8931
-9266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+8931
-9266
lines changed

.circleci/config.yml

Lines changed: 55 additions & 602 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: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ commands:
146146
default: true
147147
steps:
148148
- pip_install:
149-
args: --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
149+
args: --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu
150150
descr: Install PyTorch from nightly releases
151151
- pip_install:
152152
args: --no-build-isolation <<# parameters.editable >> --editable <</ parameters.editable >> .
@@ -155,8 +155,11 @@ commands:
155155
install_prototype_dependencies:
156156
steps:
157157
- pip_install:
158-
args: iopath git+https://github.com/pytorch/data
159-
descr: Install prototype dependencies
158+
args: iopath
159+
descr: Install third-party dependencies
160+
- pip_install:
161+
args: --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu
162+
descr: Install torchdata from nightly releases
160163

161164
# Most of the test suite is handled by the `unittest` jobs, with completely different workflow and setup.
162165
# This command can be used if only a selection of tests need to be run, for ad-hoc files.
@@ -174,6 +177,26 @@ commands:
174177
- store_test_results:
175178
path: test-results
176179

180+
download_model_weights:
181+
parameters:
182+
extract_roots:
183+
type: string
184+
default: "torchvision/models"
185+
background:
186+
type: boolean
187+
default: true
188+
steps:
189+
- apt_install:
190+
args: parallel wget
191+
descr: Install download utilitites
192+
- run:
193+
name: Download model weights
194+
background: << parameters.background >>
195+
command: |
196+
mkdir -p ~/.cache/torch/hub/checkpoints
197+
python scripts/collect_model_urls.py << parameters.extract_roots >> \
198+
| parallel -j0 'wget --no-verbose -O ~/.cache/torch/hub/checkpoints/`basename {}` {}\?source=ci'
199+
177200
binary_common: &binary_common
178201
parameters:
179202
# Edit these defaults to do a release
@@ -243,7 +266,7 @@ smoke_test_common: &smoke_test_common
243266
jobs:
244267
circleci_consistency:
245268
docker:
246-
- image: circleci/python:3.7
269+
- image: cimg/python:3.7
247270
steps:
248271
- checkout
249272
- pip_install:
@@ -256,7 +279,7 @@ jobs:
256279

257280
lint_python_and_config:
258281
docker:
259-
- image: circleci/python:3.7
282+
- image: cimg/python:3.7
260283
steps:
261284
- checkout
262285
- pip_install:
@@ -275,7 +298,7 @@ jobs:
275298

276299
lint_c:
277300
docker:
278-
- image: circleci/python:3.7
301+
- image: cimg/python:3.7
279302
steps:
280303
- apt_install:
281304
args: libtinfo5
@@ -297,7 +320,7 @@ jobs:
297320

298321
type_check_python:
299322
docker:
300-
- image: circleci/python:3.7
323+
- image: cimg/python:3.7
301324
steps:
302325
- apt_install:
303326
args: libturbojpeg-dev
@@ -315,7 +338,7 @@ jobs:
315338

316339
unittest_torchhub:
317340
docker:
318-
- image: circleci/python:3.7
341+
- image: cimg/python:3.7
319342
steps:
320343
- checkout
321344
- install_torchvision
@@ -324,7 +347,7 @@ jobs:
324347

325348
unittest_onnx:
326349
docker:
327-
- image: circleci/python:3.7
350+
- image: cimg/python:3.7
328351
steps:
329352
- checkout
330353
- install_torchvision
@@ -336,29 +359,32 @@ jobs:
336359

337360
unittest_prototype:
338361
docker:
339-
- image: circleci/python:3.7
362+
- image: cimg/python:3.7
340363
resource_class: xlarge
341364
steps:
342365
- checkout
343-
- run:
344-
name: Download model weights
345-
background: true
346-
command: |
347-
sudo apt update -qy && sudo apt install -qy parallel wget
348-
mkdir -p ~/.cache/torch/hub/checkpoints
349-
python scripts/collect_model_urls.py torchvision/prototype/models \
350-
| parallel -j0 'wget --no-verbose -O ~/.cache/torch/hub/checkpoints/`basename {}` {}\?source=ci'
351366
- install_torchvision
352367
- install_prototype_dependencies
353368
- pip_install:
354369
args: scipy pycocotools h5py
355370
descr: Install optional dependencies
356-
- run:
357-
name: Enable prototype tests
358-
command: echo 'export PYTORCH_TEST_WITH_PROTOTYPE=1' >> $BASH_ENV
359371
- run_tests_selective:
360372
file_or_dir: test/test_prototype_*.py
361373

374+
unittest_extended:
375+
docker:
376+
- image: cimg/python:3.7
377+
resource_class: xlarge
378+
steps:
379+
- checkout
380+
- download_model_weights
381+
- install_torchvision
382+
- run:
383+
name: Enable extended tests
384+
command: echo 'export PYTORCH_TEST_WITH_EXTENDED=1' >> $BASH_ENV
385+
- run_tests_selective:
386+
file_or_dir: test/test_extended_*.py
387+
362388
binary_linux_wheel:
363389
<<: *binary_common
364390
docker:
@@ -509,7 +535,7 @@ jobs:
509535
binary_android_build:
510536
<<: *torchvision_android_params
511537
docker:
512-
- image: circleci/android:api-29-ndk
538+
- image: cimg/android:2021.08-ndk
513539
resource_class: xlarge
514540
steps:
515541
- attach_workspace:
@@ -528,7 +554,7 @@ jobs:
528554
binary_android_upload:
529555
<<: *torchvision_android_params
530556
docker:
531-
- image: circleci/android:api-29-ndk
557+
- image: cimg/android:2021.08-ndk
532558
resource_class: xlarge
533559
steps:
534560
- attach_workspace:
@@ -587,7 +613,7 @@ jobs:
587613
description: "What whl subfolder to upload to, e.g., blank or cu100/ (trailing slash is important)"
588614
type: string
589615
docker:
590-
- image: circleci/python:3.7
616+
- image: cimg/python:3.7
591617
steps:
592618
- attach_workspace:
593619
at: ~/workspace
@@ -1011,12 +1037,13 @@ jobs:
10111037
build_docs:
10121038
<<: *binary_common
10131039
docker:
1014-
- image: "pytorch/manylinux-cuda100"
1040+
- image: cimg/python:3.7
10151041
resource_class: 2xlarge+
10161042
steps:
10171043
- attach_workspace:
10181044
at: ~/workspace
10191045
- checkout
1046+
- download_model_weights
10201047
- run:
10211048
name: Setup
10221049
command: .circleci/unittest/linux/scripts/setup_env.sh
@@ -1069,7 +1096,8 @@ jobs:
10691096
# Don't use "checkout" step since it uses ssh, which cannot git push
10701097
# https://circleci.com/docs/2.0/configuration-reference/#checkout
10711098
set -ex
1072-
tag=${CIRCLE_TAG:1:5}
1099+
# Change v1.12.1rc1 into 1.12 (only major.minor)
1100+
tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9]*\.[0-9]*\).*/\1/')
10731101
target=${tag:-main}
10741102
~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target
10751103

@@ -1093,6 +1121,7 @@ workflows:
10931121
- unittest_torchhub
10941122
- unittest_onnx
10951123
- unittest_prototype
1124+
- unittest_extended
10961125
{{ unittest_workflows() }}
10971126

10981127
cmake:

.circleci/regenerate.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix=""
8484

8585
if upload:
8686
w.append(generate_upload_workflow(base_workflow_name, os_type, btype, cu_version, filter_branch=filter_branch))
87-
if filter_branch == "nightly" and os_type in ["linux", "win"]:
88-
pydistro = "pip" if btype == "wheel" else "conda"
89-
w.append(generate_smoketest_workflow(pydistro, base_workflow_name, filter_branch, python_version, os_type))
87+
# disable smoke tests, they are broken and needs to be fixed
88+
# if filter_branch == "nightly" and os_type in ["linux", "win"]:
89+
# pydistro = "pip" if btype == "wheel" else "conda"
90+
# w.append(generate_smoketest_workflow(pydistro, base_workflow_name, filter_branch, python_version, os_type))
9091

9192
return w
9293

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ else
2121
fi
2222
echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION"
2323
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
24-
cudatoolkit="cudatoolkit=${version}"
24+
cudatoolkit="nvidia::cudatoolkit=${version}"
2525
fi
2626

2727
case "$(uname -s)" in
@@ -33,7 +33,7 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}"
3333
if [ "${os}" == "MacOSX" ]; then
3434
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest
3535
else
36-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}" pytest
36+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c nvidia "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}" pytest
3737
fi
3838

3939
printf "* Installing torchvision\n"

.circleci/unittest/linux/scripts/run_test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ set -e
55
eval "$(./conda/bin/conda shell.bash hook)"
66
conda activate ./env
77

8-
export PYTORCH_TEST_WITH_SLOW='1'
98
python -m torch.utils.collect_env
109
pytest --junitxml=test-results/junit.xml -v --durations 20

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ conda activate ./env
88
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
99
source "$this_dir/set_cuda_envs.sh"
1010

11-
export PYTORCH_TEST_WITH_SLOW='1'
1211
python -m torch.utils.collect_env
1312
pytest --junitxml=test-results/junit.xml -v --durations 20

.git-blame-ignore-revs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file keeps git blame clean.
2+
# See https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
3+
4+
# Add ufmt (usort + black) as code formatter (#4384)
5+
5f0edb97b46e5bff71dc19dedef05c5396eeaea2
6+
# update python syntax >=3.6 (#4585)
7+
d367a01a18a3ae6bee13d8be3b63fd6a581ea46f

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Instead of relying directly on `black` however, we rely on
8383
[ufmt](https://github.com/omnilib/ufmt), for compatibility reasons with Facebook
8484
internal infrastructure.
8585

86-
To format your code, install `ufmt` with `pip install ufmt` and use e.g.:
86+
To format your code, install `ufmt` with `pip install ufmt==1.3.2 black==21.9b0 usort==0.6.4` and use e.g.:
8787

8888
```bash
8989
ufmt format torchvision

README.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ supported Python versions.
2121
+--------------------------+--------------------------+---------------------------------+
2222
| ``torch`` | ``torchvision`` | ``python`` |
2323
+==========================+==========================+=================================+
24-
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.7``, ``<=3.9`` |
24+
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.7``, ``<=3.10`` |
25+
+--------------------------+--------------------------+---------------------------------+
26+
| ``1.11.0`` | ``0.12.0`` | ``>=3.7``, ``<=3.10`` |
2527
+--------------------------+--------------------------+---------------------------------+
2628
| ``1.10.2`` | ``0.11.3`` | ``>=3.6``, ``<=3.9`` |
2729
+--------------------------+--------------------------+---------------------------------+
@@ -183,3 +185,10 @@ Disclaimer on Datasets
183185
This is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have license to use the dataset. It is your responsibility to determine whether you have permission to use the dataset under the dataset's license.
184186

185187
If you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML community!
188+
189+
Pre-trained Model License
190+
=========================
191+
192+
The pre-trained models provided in this library may have their own licenses or terms and conditions derived from the dataset used for training. It is your responsibility to determine whether you have permission to use the models for your use case.
193+
194+
More specifically, SWAG models are released under the CC-BY-NC 4.0 license. See `SWAG LICENSE <https://github.com/facebookresearch/SWAG/blob/main/LICENSE>`_ for additional details.

android/test_app/make_assets.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import torch
2-
import torchvision
32
from torch.utils.mobile_optimizer import optimize_for_mobile
3+
from torchvision.models.detection import (
4+
fasterrcnn_mobilenet_v3_large_320_fpn,
5+
FasterRCNN_MobileNet_V3_Large_320_FPN_Weights,
6+
)
47

58
print(torch.__version__)
69

7-
model = torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn(
8-
pretrained=True, box_score_thresh=0.7, rpn_post_nms_top_n_test=100, rpn_score_thresh=0.4, rpn_pre_nms_top_n_test=150
10+
model = fasterrcnn_mobilenet_v3_large_320_fpn(
11+
weights=FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.DEFAULT,
12+
box_score_thresh=0.7,
13+
rpn_post_nms_top_n_test=100,
14+
rpn_score_thresh=0.4,
15+
rpn_pre_nms_top_n_test=150,
916
)
1017

1118
model.eval()

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ numpy
33
sphinx-copybutton>=0.3.1
44
sphinx-gallery>=0.9.0
55
sphinx==3.5.4
6+
# This pin is only needed for sphinx<4.0.2. See https://github.com/pytorch/vision/issues/5673 for details
7+
Jinja2<3.1.*
68
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme

docs/source/conf.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
# import sys
2121
# sys.path.insert(0, os.path.abspath('.'))
2222

23+
import os
24+
2325
import pytorch_sphinx_theme
2426
import torchvision
2527

@@ -80,11 +82,16 @@
8082
# built documents.
8183
#
8284
# The short X.Y version.
83-
# TODO: change to [:2] at v1.0
8485
version = "main (" + torchvision.__version__ + " )"
8586
# The full version, including alpha/beta/rc tags.
86-
# TODO: verify this works as expected
8787
release = "main"
88+
VERSION = os.environ.get("VERSION", None)
89+
if VERSION:
90+
# Turn 1.11.0aHASH into 1.11 (major.minor only)
91+
version = ".".join(version.split(".")[:2])
92+
html_title = " ".join((project, version, "documentation"))
93+
release = version
94+
8895

8996
# The language for content autogenerated by Sphinx. Refer to documentation
9097
# for a list of supported languages.

0 commit comments

Comments
 (0)