Skip to content

Commit 8916f65

Browse files
authored
Merge branch 'main' into fix/err_msg_random_apply
2 parents ddebab4 + d247de8 commit 8916f65

24 files changed

+677
-284
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

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def get_dist(pkgname):
111111
]
112112

113113
# Excluding 8.3.* because of https://github.com/pytorch/vision/issues/4934
114-
pillow_ver = " >= 5.3.0, !=8.3.*"
114+
# TODO remove <11.3 bound and address corresponding deprecation warnings
115+
pillow_ver = " >= 5.3.0, !=8.3.*, <11.3"
115116
pillow_req = "pillow-simd" if get_dist("pillow-simd") is not None else "pillow"
116117
requirements.append(pillow_req + pillow_ver)
117118

3.05 KB
Loading

test/common_utils.py

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from torch.testing._comparison import BooleanPair, NonePair, not_close_error_metas, NumberPair, TensorLikePair
2222
from torchvision import io, tv_tensors
2323
from torchvision.transforms._functional_tensor import _max_value as get_max_value
24-
from torchvision.transforms.v2.functional import clamp_bounding_boxes, to_image, to_pil_image
24+
from torchvision.transforms.v2.functional import to_image, to_pil_image
2525

2626

2727
IN_OSS_CI = any(os.getenv(var) == "true" for var in ["CIRCLECI", "GITHUB_ACTIONS"])
@@ -410,6 +410,7 @@ def make_bounding_boxes(
410410
canvas_size=DEFAULT_SIZE,
411411
*,
412412
format=tv_tensors.BoundingBoxFormat.XYXY,
413+
clamping_mode="soft",
413414
num_boxes=1,
414415
dtype=None,
415416
device="cpu",
@@ -423,13 +424,6 @@ def sample_position(values, max_value):
423424
format = tv_tensors.BoundingBoxFormat[format]
424425

425426
dtype = dtype or torch.float32
426-
int_dtype = dtype in (
427-
torch.uint8,
428-
torch.int8,
429-
torch.int16,
430-
torch.int32,
431-
torch.int64,
432-
)
433427

434428
h, w = (torch.randint(1, s, (num_boxes,)) for s in canvas_size)
435429
y = sample_position(h, canvas_size[0])
@@ -456,31 +450,19 @@ def sample_position(values, max_value):
456450
elif format is tv_tensors.BoundingBoxFormat.XYXYXYXY:
457451
r_rad = r * torch.pi / 180.0
458452
cos, sin = torch.cos(r_rad), torch.sin(r_rad)
459-
x1 = torch.round(x) if int_dtype else x
460-
y1 = torch.round(y) if int_dtype else y
461-
x2 = torch.round(x1 + w * cos) if int_dtype else x1 + w * cos
462-
y2 = torch.round(y1 - w * sin) if int_dtype else y1 - w * sin
463-
x3 = torch.round(x2 + h * sin) if int_dtype else x2 + h * sin
464-
y3 = torch.round(y2 + h * cos) if int_dtype else y2 + h * cos
465-
x4 = torch.round(x1 + h * sin) if int_dtype else x1 + h * sin
466-
y4 = torch.round(y1 + h * cos) if int_dtype else y1 + h * cos
453+
x1 = x
454+
y1 = y
455+
x2 = x1 + w * cos
456+
y2 = y1 - w * sin
457+
x3 = x2 + h * sin
458+
y3 = y2 + h * cos
459+
x4 = x1 + h * sin
460+
y4 = y1 + h * cos
467461
parts = (x1, y1, x2, y2, x3, y3, x4, y4)
468462
else:
469463
raise ValueError(f"Format {format} is not supported")
470464
out_boxes = torch.stack(parts, dim=-1).to(dtype=dtype, device=device)
471-
if tv_tensors.is_rotated_bounding_format(format):
472-
# The rotated bounding boxes are not guaranteed to be within the canvas by design,
473-
# so we apply clamping. We also add a 2 buffer to the canvas size to avoid
474-
# numerical issues during the testing
475-
buffer = 4
476-
out_boxes = clamp_bounding_boxes(
477-
out_boxes, format=format, canvas_size=(canvas_size[0] - buffer, canvas_size[1] - buffer)
478-
)
479-
if format is tv_tensors.BoundingBoxFormat.XYWHR or format is tv_tensors.BoundingBoxFormat.CXCYWHR:
480-
out_boxes[:, :2] += buffer // 2
481-
elif format is tv_tensors.BoundingBoxFormat.XYXYXYXY:
482-
out_boxes[:, :] += buffer // 2
483-
return tv_tensors.BoundingBoxes(out_boxes, format=format, canvas_size=canvas_size)
465+
return tv_tensors.BoundingBoxes(out_boxes, format=format, canvas_size=canvas_size, clamping_mode=clamping_mode)
484466

485467

486468
def make_detection_masks(size=DEFAULT_SIZE, *, num_masks=1, dtype=None, device="cpu"):

0 commit comments

Comments
 (0)