Skip to content

Commit 1916bd7

Browse files
committed
Merge branch 'main' into prototype-datasets-inheritance
2 parents c6b447b + 19d8987 commit 1916bd7

File tree

14 files changed

+107
-356
lines changed

14 files changed

+107
-356
lines changed

.circleci/config.yml

Lines changed: 1 addition & 301 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ jobs:
848848
executor:
849849
name: windows-gpu
850850
environment:
851-
CUDA_VERSION: "11.1"
851+
CUDA_VERSION: "11.3"
852852
PYTHON_VERSION: << parameters.python_version >>
853853
steps:
854854
- checkout

.circleci/regenerate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
3333
python_versions = PYTHON_VERSIONS
3434
cu_versions_dict = {
3535
"linux": ["cpu", "cu102", "cu111", "cu113", "cu115", "rocm4.3.1", "rocm4.5.2"],
36-
"win": ["cpu", "cu111", "cu113", "cu115"],
36+
"win": ["cpu", "cu113", "cu115"],
3737
"macos": ["cpu"],
3838
}
3939
cu_versions = cu_versions_dict[os_type]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ dependencies:
99
- libpng
1010
- jpeg
1111
- ca-certificates
12-
- h5py
12+
- hdf5
1313
- pip:
1414
- future
1515
- pillow >=5.3.0, !=8.3.*
1616
- scipy
1717
- av
1818
- dataclasses
19+
- h5py

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ else
2828
fi
2929

3030
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
31-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}" pytest
31+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c nvidia "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}" pytest
3232

3333
torch_cuda=$(python -c "import torch; print(torch.cuda.is_available())")
3434
echo torch.cuda.is_available is $torch_cuda

scripts/release_notes/classify_prs.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# In[1]:
22

3-
3+
# imports and set configuration
44
import pandas as pd
5+
from retrieve_prs_data import run
56

7+
exclude_prototype = True
8+
data_filename = "10.0_to_11.0-rc2.json"
9+
previous_release = "v10.0"
10+
current_release = "v11.0-rc2"
611

712
# In[2]:
813

914

10-
df = pd.read_json("10.0_to_11.0-rc2.json").T
15+
df = pd.read_json(data_filename).T
1116
df.tail()
1217

1318

@@ -76,6 +81,8 @@
7681
def format_prs(mod_df):
7782
out = []
7883
for idx, row in mod_df.iterrows():
84+
if exclude_prototype and row["prototype"]:
85+
continue
7986
modules = idx
8087
# Put "documentation" and "tests" first for sorting to be dece
8188
for last_module in ("documentation", "tests"):
@@ -119,3 +126,13 @@ def format_prs(mod_df):
119126
# Missing PRs are these ones... classify them manually
120127
missing_prs = pd.concat([mod_df, included_prs]).drop_duplicates(subset="pr_number", keep=False)
121128
print(format_prs(missing_prs))
129+
130+
# In[12]:
131+
132+
# Generate list of contributors
133+
print()
134+
print("## Contributors")
135+
136+
command_to_run = f"{{ git shortlog -s {previous_release}..{current_release} | cut -f2- & git log -s {previous_release}..{current_release} | grep Co-authored | cut -f2- -d: | cut -f1 -d\\< | sed 's/^ *//;s/ *$//' ; }} | sort --ignore-case | uniq | tr '\\n' ';' | sed 's/;/, /g;s/, $//' | fold -s"
137+
rc, output, err = run(command_to_run)
138+
print(output)

test/test_transforms_tensor.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23

34
import numpy as np
45
import pytest
@@ -958,6 +959,17 @@ def test_random_apply(device):
958959
)
959960
@pytest.mark.parametrize("channels", [1, 3])
960961
def test_gaussian_blur(device, channels, meth_kwargs):
962+
if all(
963+
[
964+
device == "cuda",
965+
channels == 1,
966+
meth_kwargs["kernel_size"] in [23, [23]],
967+
torch.version.cuda == "11.3",
968+
sys.platform in ("win32", "cygwin"),
969+
]
970+
):
971+
pytest.skip("Fails on Windows, see https://github.com/pytorch/vision/issues/5464")
972+
961973
tol = 1.0 + 1e-10
962974
torch.manual_seed(12)
963975
_test_class_op(

torchvision/models/detection/_utils.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,27 @@ def retrieve_out_channels(model: nn.Module, size: Tuple[int, int]) -> List[int]:
468468
model.train()
469469

470470
return out_channels
471+
472+
473+
def _topk_min(input: Tensor, orig_kval: int, axis: int) -> Tensor:
474+
"""
475+
ONNX spec requires the k-value to be less than or equal to the number of inputs along
476+
provided dim. Certain models use the number of elements along a particular axis instead of K
477+
if K exceeds the number of elements along that axis. Previously, python's min() function was
478+
used to determine whether to use the provided k-value or the specified dim axis value.
479+
480+
However in cases where the model is being exported in tracing mode, python min() is
481+
static causing the model to be traced incorrectly and eventually fail at the topk node.
482+
In order to avoid this situation, in tracing mode, torch.min() is used instead.
483+
484+
Args:
485+
input (Tensor): The orignal input tensor.
486+
orig_kval (int): The provided k-value.
487+
axis(int): Axis along which we retreive the input size.
488+
489+
Returns:
490+
min_kval (Tensor): Appropriately selected k-value.
491+
"""
492+
axis_dim_val = torch._shape_as_tensor(input)[axis].unsqueeze(0)
493+
min_kval = torch.min(torch.cat((torch.tensor([orig_kval], dtype=axis_dim_val.dtype), axis_dim_val), 0))
494+
return min_kval # type: ignore[arg-type]

torchvision/models/detection/fcos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def postprocess_detections(
501501
topk_idxs = torch.where(keep_idxs)[0]
502502

503503
# keep only topk scoring predictions
504-
num_topk = min(self.topk_candidates, topk_idxs.size(0))
504+
num_topk = det_utils._topk_min(topk_idxs, self.topk_candidates, 0)
505505
scores_per_level, idxs = scores_per_level.topk(num_topk)
506506
topk_idxs = topk_idxs[idxs]
507507

torchvision/models/detection/retinanet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def postprocess_detections(self, head_outputs, anchors, image_shapes):
436436
topk_idxs = torch.where(keep_idxs)[0]
437437

438438
# keep only topk scoring predictions
439-
num_topk = min(self.topk_candidates, topk_idxs.size(0))
439+
num_topk = det_utils._topk_min(topk_idxs, self.topk_candidates, 0)
440440
scores_per_level, idxs = scores_per_level.topk(num_topk)
441441
topk_idxs = topk_idxs[idxs]
442442

0 commit comments

Comments
 (0)