Skip to content

Commit 5b2af7c

Browse files
Merge branch 'main' into rotated-bboxes-transforms
2 parents be3619f + 6aee5ed commit 5b2af7c

File tree

9 files changed

+89
-73
lines changed

9 files changed

+89
-73
lines changed

.github/workflows/build-cmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
gpu-arch-type: cpu
1919
- runner: linux.g5.4xlarge.nvidia.gpu
2020
gpu-arch-type: cuda
21-
gpu-arch-version: "11.8"
21+
gpu-arch-version: "12.6"
2222
fail-fast: false
2323
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
2424
permissions:
@@ -66,7 +66,7 @@ jobs:
6666
gpu-arch-type: cpu
6767
- runner: windows.g5.4xlarge.nvidia.gpu
6868
gpu-arch-type: cuda
69-
gpu-arch-version: "11.8"
69+
gpu-arch-version: "12.6"
7070
fail-fast: false
7171
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
7272
with:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build Windows ARM64 Wheels
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/build_wheel_windows_arm64.yml
7+
push:
8+
branches:
9+
- nightly
10+
- release/*
11+
tags:
12+
# NOTE: Binary build pipelines should only get triggered on release candidate builds
13+
# Release candidate tags look like: v1.11.0-rc1
14+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
15+
workflow_dispatch:
16+
17+
permissions:
18+
id-token: write
19+
contents: read
20+
21+
jobs:
22+
generate-matrix:
23+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
24+
with:
25+
package-type: wheel
26+
os: windows-arm64
27+
test-infra-repository: pytorch/test-infra
28+
test-infra-ref: main
29+
with-cuda: disable
30+
31+
build:
32+
needs: generate-matrix
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- repository: pytorch/vision
38+
smoke-test-script: test/smoke_test.py
39+
pre-script: packaging/pre_build_script_arm64.sh
40+
package-name: torchvision
41+
architecture: "arm64"
42+
name: ${{ matrix.repository }}
43+
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main
44+
with:
45+
repository: ${{ matrix.repository }}
46+
ref: ""
47+
test-infra-repository: pytorch/test-infra
48+
test-infra-ref: main
49+
pre-script: ${{ matrix.pre-script }}
50+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
51+
package-name: ${{ matrix.package-name }}
52+
smoke-test-script: ${{ matrix.smoke-test-script }}
53+
trigger-event: ${{ github.event_name }}
54+
architecture: ${{ matrix.architecture }}

.github/workflows/prototype-tests-linux-gpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- python-version: "3.9"
2222
runner: linux.g5.4xlarge.nvidia.gpu
2323
gpu-arch-type: cuda
24-
gpu-arch-version: "11.8"
24+
gpu-arch-version: "12.6"
2525
fail-fast: false
2626
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
2727
permissions:

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- python-version: 3.9
2525
runner: linux.g5.4xlarge.nvidia.gpu
2626
gpu-arch-type: cuda
27-
gpu-arch-version: "11.8"
27+
gpu-arch-version: "12.6"
2828
fail-fast: false
2929
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
3030
permissions:

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ instructions](https://pytorch.org/get-started/locally/). Note that the official
3838
instructions may ask you to install torchvision itself. If you are doing development
3939
on torchvision, you should not install prebuilt torchvision packages.
4040

41-
**Optionally**, install `libpng` and `libjpeg-turbo` if you want to enable
41+
**Optionally**, install `libpng`, `libjpeg-turbo` and `libwebp` if you want to enable
4242
support for
43-
native encoding / decoding of PNG and JPEG formats in
43+
native encoding / decoding of PNG, JPEG and WebP formats in
4444
[torchvision.io](https://pytorch.org/vision/stable/io.html#image):
4545

4646
```bash
47-
conda install libpng libjpeg-turbo -c pytorch
47+
conda install libpng libjpeg-turbo libwebp -c pytorch
4848
```
4949

5050
Note: you can use the `TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY`

packaging/pre_build_script_arm64.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ echo "Building vision dependencies and wheel started."
66
export SRC_PATH="$GITHUB_WORKSPACE/$SRC_DIR"
77
export CMAKE_BUILD_TYPE="$BUILD_TYPE"
88
export VCVARSALL_PATH="$DEPENDENCIES_DIR/VSBuildTools/VC/Auxiliary/Build/vcvarsall.bat"
9-
export CONDA_PREFIX="$DEPENDENCIES_DIR"
10-
export PATH="$PATH:$CONDA_PREFIX/Library/bin"
11-
export DISTUTILS_USE_SDK=1
129
export TRIPLET_FILE="triplets/arm64-windows.cmake"
1310
export PYTORCH_VERSION="$PYTORCH_VERSION"
1411
export CHANNEL="$CHANNEL"

references/detection/coco_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def convert_to_coco_api(ds):
123123
coco_ds = COCO()
124124
# annotation IDs need to start at 1, not 0, see torchvision issue #1530
125125
ann_id = 1
126-
dataset = {"images": [], "categories": [], "annotations": []}
126+
dataset = {"images": [], "categories": [], "annotations": [], "info": {}}
127127
categories = set()
128128
for img_idx in range(len(ds)):
129129
# find better way to get target

test/test_ops.py

Lines changed: 26 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,67 +1201,32 @@ def test_forward_scriptability(self):
12011201
torch.jit.script(ops.DeformConv2d(in_channels=8, out_channels=8, kernel_size=3))
12021202

12031203

1204-
@pytest.mark.parametrize("dtype", (torch.float16, torch.float32, torch.float64))
1205-
@pytest.mark.parametrize("device", cpu_and_cuda())
1206-
@pytest.mark.parametrize("requires_grad", (True, False))
1207-
def test_deform_conv2d_opcheck(dtype, device, requires_grad):
1208-
batch_size, channels_in, height, width = 1, 6, 10, 10
1209-
kernel_size = (3, 3)
1210-
stride = (1, 1)
1211-
padding = (1, 1)
1212-
dilation = (1, 1)
1213-
groups = 2
1214-
out_channels = 4
1215-
out_h = (height + 2 * padding[0] - dilation[0] * (kernel_size[0] - 1) - 1) // stride[0] + 1
1216-
out_w = (width + 2 * padding[1] - dilation[1] * (kernel_size[1] - 1) - 1) // stride[1] + 1
1217-
x = torch.randn(batch_size, channels_in, height, width, dtype=dtype, device=device, requires_grad=requires_grad)
1218-
offset = torch.randn(
1219-
batch_size,
1220-
2 * kernel_size[0] * kernel_size[1],
1221-
out_h,
1222-
out_w,
1223-
dtype=dtype,
1224-
device=device,
1225-
requires_grad=requires_grad,
1226-
)
1227-
weight = torch.randn(
1228-
out_channels,
1229-
channels_in // groups,
1230-
kernel_size[0],
1231-
kernel_size[1],
1232-
dtype=dtype,
1233-
device=device,
1234-
requires_grad=requires_grad,
1235-
)
1236-
bias = torch.randn(out_channels, dtype=dtype, device=device, requires_grad=requires_grad)
1237-
use_mask = True
1238-
mask = torch.sigmoid(
1239-
torch.randn(
1240-
batch_size,
1241-
kernel_size[0] * kernel_size[1],
1242-
out_h,
1243-
out_w,
1244-
dtype=dtype,
1245-
device=device,
1246-
requires_grad=requires_grad,
1247-
)
1248-
)
1249-
kwargs = {
1250-
"offset": offset,
1251-
"weight": weight,
1252-
"bias": bias,
1253-
"stride_h": stride[0],
1254-
"stride_w": stride[1],
1255-
"pad_h": padding[0],
1256-
"pad_w": padding[1],
1257-
"dilation_h": dilation[0],
1258-
"dilation_w": dilation[1],
1259-
"groups": groups,
1260-
"offset_groups": 1,
1261-
"use_mask": use_mask,
1262-
"mask": mask, # no modulation in this test
1263-
}
1264-
optests.opcheck(torch.ops.torchvision.deform_conv2d, args=(x,), kwargs=kwargs)
1204+
# NS: Remove me once backward is implemented for MPS
1205+
def xfail_if_mps(x):
1206+
mps_xfail_param = pytest.param("mps", marks=(pytest.mark.needs_mps, pytest.mark.xfail))
1207+
new_pytestmark = []
1208+
for mark in x.pytestmark:
1209+
if isinstance(mark, pytest.Mark) and mark.name == "parametrize":
1210+
if mark.args[0] == "device":
1211+
params = cpu_and_cuda() + (mps_xfail_param,)
1212+
new_pytestmark.append(pytest.mark.parametrize("device", params))
1213+
continue
1214+
new_pytestmark.append(mark)
1215+
x.__dict__["pytestmark"] = new_pytestmark
1216+
return x
1217+
1218+
1219+
optests.generate_opcheck_tests(
1220+
testcase=TestDeformConv,
1221+
namespaces=["torchvision"],
1222+
failures_dict_path=os.path.join(os.path.dirname(__file__), "optests_failures_dict.json"),
1223+
# Skip tests due to unimplemented backward
1224+
additional_decorators={
1225+
"test_aot_dispatch_dynamic__test_forward": [xfail_if_mps],
1226+
"test_autograd_registration__test_forward": [xfail_if_mps],
1227+
},
1228+
test_utils=OPTESTS,
1229+
)
12651230

12661231

12671232
class TestFrozenBNT:

torchvision/tv_tensors/_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __new__(
4343

4444
tensor = cls._to_tensor(data, dtype=dtype, device=device, requires_grad=requires_grad)
4545
if tensor.ndim < 2:
46-
raise ValueError
46+
raise ValueError(f"Tensor must be 2D or higher, got {tensor.ndim}D tensor.")
4747
elif tensor.ndim == 2:
4848
tensor = tensor.unsqueeze(0)
4949

0 commit comments

Comments
 (0)