Skip to content

Commit 408b98f

Browse files
authored
Merge branch 'main' into transforms/photometricdistort
2 parents da4d047 + 6db54fb commit 408b98f

Some content is hidden

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

58 files changed

+1053
-448
lines changed

.circleci/config.yml

Lines changed: 15 additions & 18 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: 15 additions & 18 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 >> .
@@ -158,11 +158,8 @@ commands:
158158
args: iopath
159159
descr: Install third-party dependencies
160160
- pip_install:
161-
args: -r https://raw.githubusercontent.com/pytorch/data/main/requirements.txt
162-
descr: Install torchdata build dependencies
163-
- pip_install:
164-
args: --no-build-isolation git+https://github.com/pytorch/data
165-
descr: Install torchdata from source
161+
args: --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu
162+
descr: Install torchdata from nightly releases
166163

167164
# Most of the test suite is handled by the `unittest` jobs, with completely different workflow and setup.
168165
# This command can be used if only a selection of tests need to be run, for ad-hoc files.
@@ -269,7 +266,7 @@ smoke_test_common: &smoke_test_common
269266
jobs:
270267
circleci_consistency:
271268
docker:
272-
- image: circleci/python:3.7
269+
- image: cimg/python:3.7
273270
steps:
274271
- checkout
275272
- pip_install:
@@ -282,7 +279,7 @@ jobs:
282279

283280
lint_python_and_config:
284281
docker:
285-
- image: circleci/python:3.7
282+
- image: cimg/python:3.7
286283
steps:
287284
- checkout
288285
- pip_install:
@@ -301,7 +298,7 @@ jobs:
301298

302299
lint_c:
303300
docker:
304-
- image: circleci/python:3.7
301+
- image: cimg/python:3.7
305302
steps:
306303
- apt_install:
307304
args: libtinfo5
@@ -323,7 +320,7 @@ jobs:
323320

324321
type_check_python:
325322
docker:
326-
- image: circleci/python:3.7
323+
- image: cimg/python:3.7
327324
steps:
328325
- apt_install:
329326
args: libturbojpeg-dev
@@ -341,7 +338,7 @@ jobs:
341338

342339
unittest_torchhub:
343340
docker:
344-
- image: circleci/python:3.7
341+
- image: cimg/python:3.7
345342
steps:
346343
- checkout
347344
- install_torchvision
@@ -350,7 +347,7 @@ jobs:
350347

351348
unittest_onnx:
352349
docker:
353-
- image: circleci/python:3.7
350+
- image: cimg/python:3.7
354351
steps:
355352
- checkout
356353
- install_torchvision
@@ -362,7 +359,7 @@ jobs:
362359

363360
unittest_prototype:
364361
docker:
365-
- image: circleci/python:3.7
362+
- image: cimg/python:3.7
366363
resource_class: xlarge
367364
steps:
368365
- checkout
@@ -376,7 +373,7 @@ jobs:
376373

377374
unittest_extended:
378375
docker:
379-
- image: circleci/python:3.7
376+
- image: cimg/python:3.7
380377
resource_class: xlarge
381378
steps:
382379
- checkout
@@ -538,7 +535,7 @@ jobs:
538535
binary_android_build:
539536
<<: *torchvision_android_params
540537
docker:
541-
- image: circleci/android:api-29-ndk
538+
- image: cimg/android:2021.08-ndk
542539
resource_class: xlarge
543540
steps:
544541
- attach_workspace:
@@ -557,7 +554,7 @@ jobs:
557554
binary_android_upload:
558555
<<: *torchvision_android_params
559556
docker:
560-
- image: circleci/android:api-29-ndk
557+
- image: cimg/android:2021.08-ndk
561558
resource_class: xlarge
562559
steps:
563560
- attach_workspace:
@@ -616,7 +613,7 @@ jobs:
616613
description: "What whl subfolder to upload to, e.g., blank or cu100/ (trailing slash is important)"
617614
type: string
618615
docker:
619-
- image: circleci/python:3.7
616+
- image: cimg/python:3.7
620617
steps:
621618
- attach_workspace:
622619
at: ~/workspace
@@ -1040,7 +1037,7 @@ jobs:
10401037
build_docs:
10411038
<<: *binary_common
10421039
docker:
1043-
- image: circleci/python:3.7
1040+
- image: cimg/python:3.7
10441041
resource_class: 2xlarge+
10451042
steps:
10461043
- attach_workspace:

.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

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

test/builtin_dataset_mocks.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import bz2
12
import collections.abc
23
import csv
34
import functools
@@ -9,6 +10,7 @@
910
import pathlib
1011
import pickle
1112
import random
13+
import warnings
1214
import xml.etree.ElementTree as ET
1315
from collections import defaultdict, Counter
1416

@@ -469,7 +471,10 @@ def imagenet(info, root, config):
469471
]
470472
num_children = 1
471473
synsets.extend((0, "", "", "", num_children, [], 0, 0) for _ in range(5))
472-
savemat(data_root / "meta.mat", dict(synsets=synsets))
474+
with warnings.catch_warnings():
475+
# The warning is not for savemat, but rather for some internals savemet is using
476+
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
477+
savemat(data_root / "meta.mat", dict(synsets=synsets))
473478

474479
make_tar(root, devkit_root.with_suffix(".tar.gz").name, compression="gz")
475480
else: # config.split == "test"
@@ -1431,3 +1436,21 @@ def stanford_cars(info, root, config):
14311436
make_tar(root, "car_devkit.tgz", devkit, compression="gz")
14321437

14331438
return num_samples
1439+
1440+
1441+
@register_mock
1442+
def usps(info, root, config):
1443+
num_samples = {"train": 15, "test": 7}[config.split]
1444+
1445+
with bz2.open(root / f"usps{'.t' if not config.split == 'train' else ''}.bz2", "wb") as fh:
1446+
lines = []
1447+
for _ in range(num_samples):
1448+
label = make_tensor(1, low=1, high=11, dtype=torch.int)
1449+
values = make_tensor(256, low=-1, high=1, dtype=torch.float)
1450+
lines.append(
1451+
" ".join([f"{int(label)}", *(f"{idx}:{float(value):.6f}" for idx, value in enumerate(values, 1))])
1452+
)
1453+
1454+
fh.write("\n".join(lines).encode())
1455+
1456+
return num_samples

test/test_functional_tensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class TestRotate:
6767
IMG_W = 26
6868

6969
@pytest.mark.parametrize("device", cpu_and_gpu())
70-
@pytest.mark.parametrize("height, width", [(26, IMG_W), (32, IMG_W)])
70+
@pytest.mark.parametrize("height, width", [(7, 33), (26, IMG_W), (32, IMG_W)])
7171
@pytest.mark.parametrize(
7272
"center",
7373
[
@@ -77,7 +77,7 @@ class TestRotate:
7777
],
7878
)
7979
@pytest.mark.parametrize("dt", ALL_DTYPES)
80-
@pytest.mark.parametrize("angle", range(-180, 180, 17))
80+
@pytest.mark.parametrize("angle", range(-180, 180, 34))
8181
@pytest.mark.parametrize("expand", [True, False])
8282
@pytest.mark.parametrize(
8383
"fill",

test/test_models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,24 +745,24 @@ def test_detection_model_validation(model_fn):
745745
x = [torch.rand(input_shape)]
746746

747747
# validate that targets are present in training
748-
with pytest.raises(ValueError):
748+
with pytest.raises(AssertionError):
749749
model(x)
750750

751751
# validate type
752752
targets = [{"boxes": 0.0}]
753-
with pytest.raises(TypeError):
753+
with pytest.raises(AssertionError):
754754
model(x, targets=targets)
755755

756756
# validate boxes shape
757757
for boxes in (torch.rand((4,)), torch.rand((1, 5))):
758758
targets = [{"boxes": boxes}]
759-
with pytest.raises(ValueError):
759+
with pytest.raises(AssertionError):
760760
model(x, targets=targets)
761761

762762
# validate that no degenerate boxes are present
763763
boxes = torch.tensor([[1, 3, 1, 4], [2, 4, 3, 4]])
764764
targets = [{"boxes": boxes}]
765-
with pytest.raises(ValueError):
765+
with pytest.raises(AssertionError):
766766
model(x, targets=targets)
767767

768768

test/test_models_detection_anchor_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_incorrect_anchors(self):
1616
image1 = torch.randn(3, 800, 800)
1717
image_list = ImageList(image1, [(800, 800)])
1818
feature_maps = [torch.randn(1, 50)]
19-
pytest.raises(ValueError, anc, image_list, feature_maps)
19+
pytest.raises(AssertionError, anc, image_list, feature_maps)
2020

2121
def _init_test_anchor_generator(self):
2222
anchor_sizes = ((10,),)

test/test_ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ def test_autocast(self, x_dtype, rois_dtype):
138138

139139
def _helper_boxes_shape(self, func):
140140
# test boxes as Tensor[N, 5]
141-
with pytest.raises(ValueError):
141+
with pytest.raises(AssertionError):
142142
a = torch.linspace(1, 8 * 8, 8 * 8).reshape(1, 1, 8, 8)
143143
boxes = torch.tensor([[0, 0, 3, 3]], dtype=a.dtype)
144144
func(a, boxes, output_size=(2, 2))
145145

146146
# test boxes as List[Tensor[N, 4]]
147-
with pytest.raises(ValueError):
147+
with pytest.raises(AssertionError):
148148
a = torch.linspace(1, 8 * 8, 8 * 8).reshape(1, 1, 8, 8)
149149
boxes = torch.tensor([[0, 0, 3]], dtype=a.dtype)
150150
ops.roi_pool(a, [boxes], output_size=(2, 2))

0 commit comments

Comments
 (0)