Skip to content

Commit

Permalink
Merge branch 'main' into prabhat00155/fix_shape_error
Browse files Browse the repository at this point in the history
  • Loading branch information
datumbox authored Apr 1, 2022
2 parents 085cb9e + 781b0f9 commit 59286fa
Show file tree
Hide file tree
Showing 263 changed files with 8,931 additions and 9,266 deletions.
657 changes: 55 additions & 602 deletions .circleci/config.yml

Large diffs are not rendered by default.

81 changes: 55 additions & 26 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ commands:
default: true
steps:
- pip_install:
args: --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
args: --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu
descr: Install PyTorch from nightly releases
- pip_install:
args: --no-build-isolation <<# parameters.editable >> --editable <</ parameters.editable >> .
Expand All @@ -155,8 +155,11 @@ commands:
install_prototype_dependencies:
steps:
- pip_install:
args: iopath git+https://github.com/pytorch/data
descr: Install prototype dependencies
args: iopath
descr: Install third-party dependencies
- pip_install:
args: --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu
descr: Install torchdata from nightly releases

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

download_model_weights:
parameters:
extract_roots:
type: string
default: "torchvision/models"
background:
type: boolean
default: true
steps:
- apt_install:
args: parallel wget
descr: Install download utilitites
- run:
name: Download model weights
background: << parameters.background >>
command: |
mkdir -p ~/.cache/torch/hub/checkpoints
python scripts/collect_model_urls.py << parameters.extract_roots >> \
| parallel -j0 'wget --no-verbose -O ~/.cache/torch/hub/checkpoints/`basename {}` {}\?source=ci'

binary_common: &binary_common
parameters:
# Edit these defaults to do a release
Expand Down Expand Up @@ -243,7 +266,7 @@ smoke_test_common: &smoke_test_common
jobs:
circleci_consistency:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
steps:
- checkout
- pip_install:
Expand All @@ -256,7 +279,7 @@ jobs:

lint_python_and_config:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
steps:
- checkout
- pip_install:
Expand All @@ -275,7 +298,7 @@ jobs:

lint_c:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
steps:
- apt_install:
args: libtinfo5
Expand All @@ -297,7 +320,7 @@ jobs:

type_check_python:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
steps:
- apt_install:
args: libturbojpeg-dev
Expand All @@ -315,7 +338,7 @@ jobs:

unittest_torchhub:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
steps:
- checkout
- install_torchvision
Expand All @@ -324,7 +347,7 @@ jobs:

unittest_onnx:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
steps:
- checkout
- install_torchvision
Expand All @@ -336,29 +359,32 @@ jobs:

unittest_prototype:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
resource_class: xlarge
steps:
- checkout
- run:
name: Download model weights
background: true
command: |
sudo apt update -qy && sudo apt install -qy parallel wget
mkdir -p ~/.cache/torch/hub/checkpoints
python scripts/collect_model_urls.py torchvision/prototype/models \
| parallel -j0 'wget --no-verbose -O ~/.cache/torch/hub/checkpoints/`basename {}` {}\?source=ci'
- install_torchvision
- install_prototype_dependencies
- pip_install:
args: scipy pycocotools h5py
descr: Install optional dependencies
- run:
name: Enable prototype tests
command: echo 'export PYTORCH_TEST_WITH_PROTOTYPE=1' >> $BASH_ENV
- run_tests_selective:
file_or_dir: test/test_prototype_*.py

unittest_extended:
docker:
- image: cimg/python:3.7
resource_class: xlarge
steps:
- checkout
- download_model_weights
- install_torchvision
- run:
name: Enable extended tests
command: echo 'export PYTORCH_TEST_WITH_EXTENDED=1' >> $BASH_ENV
- run_tests_selective:
file_or_dir: test/test_extended_*.py

binary_linux_wheel:
<<: *binary_common
docker:
Expand Down Expand Up @@ -509,7 +535,7 @@ jobs:
binary_android_build:
<<: *torchvision_android_params
docker:
- image: circleci/android:api-29-ndk
- image: cimg/android:2021.08-ndk
resource_class: xlarge
steps:
- attach_workspace:
Expand All @@ -528,7 +554,7 @@ jobs:
binary_android_upload:
<<: *torchvision_android_params
docker:
- image: circleci/android:api-29-ndk
- image: cimg/android:2021.08-ndk
resource_class: xlarge
steps:
- attach_workspace:
Expand Down Expand Up @@ -587,7 +613,7 @@ jobs:
description: "What whl subfolder to upload to, e.g., blank or cu100/ (trailing slash is important)"
type: string
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
steps:
- attach_workspace:
at: ~/workspace
Expand Down Expand Up @@ -1011,12 +1037,13 @@ jobs:
build_docs:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cuda100"
- image: cimg/python:3.7
resource_class: 2xlarge+
steps:
- attach_workspace:
at: ~/workspace
- checkout
- download_model_weights
- run:
name: Setup
command: .circleci/unittest/linux/scripts/setup_env.sh
Expand Down Expand Up @@ -1069,7 +1096,8 @@ jobs:
# Don't use "checkout" step since it uses ssh, which cannot git push
# https://circleci.com/docs/2.0/configuration-reference/#checkout
set -ex
tag=${CIRCLE_TAG:1:5}
# Change v1.12.1rc1 into 1.12 (only major.minor)
tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9]*\.[0-9]*\).*/\1/')
target=${tag:-main}
~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target

Expand All @@ -1093,6 +1121,7 @@ workflows:
- unittest_torchhub
- unittest_onnx
- unittest_prototype
- unittest_extended
{{ unittest_workflows() }}

cmake:
Expand Down
7 changes: 4 additions & 3 deletions .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix=""

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

return w

Expand Down
4 changes: 2 additions & 2 deletions .circleci/unittest/linux/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ else
fi
echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION"
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}"
cudatoolkit="nvidia::cudatoolkit=${version}"
fi

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

printf "* Installing torchvision\n"
Expand Down
1 change: 0 additions & 1 deletion .circleci/unittest/linux/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ set -e
eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env

export PYTORCH_TEST_WITH_SLOW='1'
python -m torch.utils.collect_env
pytest --junitxml=test-results/junit.xml -v --durations 20
1 change: 0 additions & 1 deletion .circleci/unittest/windows/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ conda activate ./env
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source "$this_dir/set_cuda_envs.sh"

export PYTORCH_TEST_WITH_SLOW='1'
python -m torch.utils.collect_env
pytest --junitxml=test-results/junit.xml -v --durations 20
7 changes: 7 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file keeps git blame clean.
# See https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view

# Add ufmt (usort + black) as code formatter (#4384)
5f0edb97b46e5bff71dc19dedef05c5396eeaea2
# update python syntax >=3.6 (#4585)
d367a01a18a3ae6bee13d8be3b63fd6a581ea46f
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Instead of relying directly on `black` however, we rely on
[ufmt](https://github.com/omnilib/ufmt), for compatibility reasons with Facebook
internal infrastructure.

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

```bash
ufmt format torchvision
Expand Down
11 changes: 10 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ supported Python versions.
+--------------------------+--------------------------+---------------------------------+
| ``torch`` | ``torchvision`` | ``python`` |
+==========================+==========================+=================================+
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.7``, ``<=3.9`` |
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.7``, ``<=3.10`` |
+--------------------------+--------------------------+---------------------------------+
| ``1.11.0`` | ``0.12.0`` | ``>=3.7``, ``<=3.10`` |
+--------------------------+--------------------------+---------------------------------+
| ``1.10.2`` | ``0.11.3`` | ``>=3.6``, ``<=3.9`` |
+--------------------------+--------------------------+---------------------------------+
Expand Down Expand Up @@ -183,3 +185,10 @@ Disclaimer on Datasets
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.

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!

Pre-trained Model License
=========================

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.

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.
13 changes: 10 additions & 3 deletions android/test_app/make_assets.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import torch
import torchvision
from torch.utils.mobile_optimizer import optimize_for_mobile
from torchvision.models.detection import (
fasterrcnn_mobilenet_v3_large_320_fpn,
FasterRCNN_MobileNet_V3_Large_320_FPN_Weights,
)

print(torch.__version__)

model = torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn(
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
model = fasterrcnn_mobilenet_v3_large_320_fpn(
weights=FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.DEFAULT,
box_score_thresh=0.7,
rpn_post_nms_top_n_test=100,
rpn_score_thresh=0.4,
rpn_pre_nms_top_n_test=150,
)

model.eval()
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ numpy
sphinx-copybutton>=0.3.1
sphinx-gallery>=0.9.0
sphinx==3.5.4
# This pin is only needed for sphinx<4.0.2. See https://github.com/pytorch/vision/issues/5673 for details
Jinja2<3.1.*
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
11 changes: 9 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os

import pytorch_sphinx_theme
import torchvision

Expand Down Expand Up @@ -80,11 +82,16 @@
# built documents.
#
# The short X.Y version.
# TODO: change to [:2] at v1.0
version = "main (" + torchvision.__version__ + " )"
# The full version, including alpha/beta/rc tags.
# TODO: verify this works as expected
release = "main"
VERSION = os.environ.get("VERSION", None)
if VERSION:
# Turn 1.11.0aHASH into 1.11 (major.minor only)
version = ".".join(version.split(".")[:2])
html_title = " ".join((project, version, "documentation"))
release = version


# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Loading

0 comments on commit 59286fa

Please sign in to comment.