Skip to content

Commit e73e5bd

Browse files
Merge branch 'main' into x64_workflow_test
2 parents 3bf56e3 + 904dad4 commit e73e5bd

File tree

202 files changed

+2474
-1942
lines changed

Some content is hidden

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

202 files changed

+2474
-1942
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ d367a01a18a3ae6bee13d8be3b63fd6a581ea46f
1111
a335d916db0694770e8152f41e19195de3134523
1212
# Renaming: `BoundingBox` -> `BoundingBoxes` (#7778)
1313
332bff937c6711666191880fab57fa2f23ae772e
14+
# Upgrade type hint and others to Python 3.9 (#8814)
15+
a095de183d3811d79ed0db2715e7a1c3162fa19d

.github/workflows/build-wheels-aarch64-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
os: linux-aarch64
2626
test-infra-repository: pytorch/test-infra
2727
test-infra-ref: main
28-
with-cuda: disable
28+
with-cuda: enable
2929
build:
3030
needs: generate-matrix
3131
strategy:

docs/source/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ powerful, e.g. if you want to encode/decode JPEGs on CUDA.
4141

4242
decode_image
4343
decode_jpeg
44-
encode_png
44+
decode_png
4545
decode_webp
4646
decode_avif
4747
decode_heic

docs/source/training_references.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ guarantees.
1919

2020
In general, these scripts rely on the latest (not yet released) pytorch version
2121
or the latest torchvision version. This means that to use them, **you might need
22-
to install the latest pytorch and torchvision versions**, with e.g.::
22+
to install the latest pytorch and torchvision versions** following the `official
23+
instructions <https://pytorch.org/get-started/locally/>`_.
2324

24-
conda install pytorch torchvision -c pytorch-nightly
2525

2626
If you need to rely on an older stable version of pytorch or torchvision, e.g.
2727
torchvision 0.10, then it's safer to use the scripts from that corresponding

mypy.ini

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ ignore_errors = True
2929

3030
ignore_errors = True
3131

32+
[mypy-torchvision.prototype.models.*]
33+
34+
ignore_errors = True
35+
3236
[mypy-torchvision.io.image.*]
3337

3438
ignore_errors = True
@@ -41,54 +45,10 @@ ignore_errors = True
4145

4246
ignore_errors = True
4347

44-
[mypy-torchvision.models.densenet.*]
48+
[mypy-torchvision.models.*]
4549

4650
ignore_errors=True
4751

48-
[mypy-torchvision.models.maxvit.*]
49-
50-
ignore_errors=True
51-
52-
[mypy-torchvision.models.detection.anchor_utils]
53-
54-
ignore_errors = True
55-
56-
[mypy-torchvision.models.detection.transform]
57-
58-
ignore_errors = True
59-
60-
[mypy-torchvision.models.detection.roi_heads]
61-
62-
ignore_errors = True
63-
64-
[mypy-torchvision.models.detection.faster_rcnn]
65-
66-
ignore_errors = True
67-
68-
[mypy-torchvision.models.detection.mask_rcnn]
69-
70-
ignore_errors = True
71-
72-
[mypy-torchvision.models.detection.keypoint_rcnn]
73-
74-
ignore_errors = True
75-
76-
[mypy-torchvision.models.detection.retinanet]
77-
78-
ignore_errors = True
79-
80-
[mypy-torchvision.models.detection.ssd]
81-
82-
ignore_errors = True
83-
84-
[mypy-torchvision.models.detection.ssdlite]
85-
86-
ignore_errors = True
87-
88-
[mypy-torchvision.models.detection.fcos]
89-
90-
ignore_errors = True
91-
9252
[mypy-torchvision.ops.*]
9353

9454
ignore_errors = True

packaging/pre_build_script_arm64.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ git clone https://github.com/microsoft/vcpkg.git
2727
cd vcpkg || exit
2828
./bootstrap-vcpkg.sh
2929

30+
3031
# # Set vcpkg to only build release packages
3132
echo "set(VCPKG_BUILD_TYPE release)" >> "$TRIPLET_FILE"
3233

@@ -41,6 +42,7 @@ cp "$DEPENDENCIES_DIR/x64-windows/bin/libpng16.dll" "$DEPENDENCIES_DIR/x64-windo
4142
cp "$DEPENDENCIES_DIR/x64-windows/bin/libpng16.pdb" "$DEPENDENCIES_DIR/x64-windows/bin/libpng.pdb"
4243
mkdir -p "$DEPENDENCIES_DIR/Library/"
4344
cp -r "$DEPENDENCIES_DIR/x64-windows/"* "$DEPENDENCIES_DIR/Library/"
45+
4446
cp -r "$DEPENDENCIES_DIR/Library/tools/libpng/"* "$DEPENDENCIES_DIR/Library/bin/"
4547
cp -r "$DEPENDENCIES_DIR/Library/bin/"* "$SRC_PATH/torchvision"
4648

@@ -58,22 +60,15 @@ pip install numpy==2.2.3
5860

5961
if [ "$CHANNEL" = "release" ]; then
6062
echo "Installing latest stable version of PyTorch."
63+
6164
pip3 install torch
6265
elif [ "$CHANNEL" = "test" ]; then
6366
echo "Installing PyTorch version $PYTORCH_VERSION."
6467
pip3 install torch=="$PYTORCH_VERSION"
68+
6569
else
6670
echo "CHANNEL is not set, installing PyTorch from nightly."
6771
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
6872
fi
6973

70-
# # Create wheel under dist folder
71-
# python setup.py bdist_wheel
72-
73-
# # Check if build was successful
74-
# if [[ $? -ne 0 ]]; then
75-
# echo "Failed on build_vision. (exit code = $?)"
76-
# exit 1
77-
# fi
78-
7974
echo "Dependencies install finished successfully."

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
NVCC_FLAGS = os.getenv("NVCC_FLAGS", None)
2525
# Note: the GPU video decoding stuff used to be called "video codec", which
2626
# isn't an accurate or descriptive name considering there are at least 2 other
27-
# video deocding backends in torchvision. I'm renaming this to "gpu video
27+
# video decoding backends in torchvision. I'm renaming this to "gpu video
2828
# decoder" where possible, keeping user facing names (like the env var below) to
2929
# the old scheme for BC.
3030
USE_GPU_VIDEO_DECODER = os.getenv("TORCHVISION_USE_VIDEO_CODEC", "1") == "1"
@@ -211,7 +211,7 @@ def find_libpng():
211211
subprocess.run([libpng_config, "--version"], stdout=subprocess.PIPE).stdout.strip().decode("utf-8")
212212
)
213213
if png_version < min_version:
214-
warnings.warn("libpng version {png_version} is less than minimum required version {min_version}")
214+
warnings.warn(f"libpng version {png_version} is less than minimum required version {min_version}")
215215
return False, None, None, None
216216

217217
include_dir = (
@@ -271,6 +271,14 @@ def find_library(header):
271271
return True, None, None
272272
print(f"{searching_for}. Didn't find in {prefix}")
273273

274+
if sys.platform == "darwin":
275+
HOMEBREW_PATH = Path("/opt/homebrew")
276+
include_dir = HOMEBREW_PATH / "include"
277+
library_dir = HOMEBREW_PATH / "lib"
278+
if (include_dir / header).exists():
279+
print(f"{searching_for}. Found in {include_dir}.")
280+
return True, str(include_dir), str(library_dir)
281+
274282
return False, None, None
275283

276284

@@ -440,7 +448,7 @@ def find_ffmpeg_libraries():
440448

441449
extensions.append(
442450
CppExtension(
443-
# This is an aweful name. It should be "cpu_video_decoder". Keeping for BC.
451+
# This is an awful name. It should be "cpu_video_decoder". Keeping for BC.
444452
"torchvision.video_reader",
445453
combined_src,
446454
include_dirs=[
680 Bytes
Loading
2.9 KB
Loading

test/common_extended_utils.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from collections import defaultdict
33
from numbers import Number
4-
from typing import Any, List
4+
from typing import Any
55

66
import torch
77
from torch.utils._python_dispatch import TorchDispatchMode
@@ -30,7 +30,7 @@ def prod(x):
3030
return res
3131

3232

33-
def matmul_flop(inputs: List[Any], outputs: List[Any]) -> Number:
33+
def matmul_flop(inputs: list[Any], outputs: list[Any]) -> Number:
3434
"""
3535
Count flops for matmul.
3636
"""
@@ -43,7 +43,7 @@ def matmul_flop(inputs: List[Any], outputs: List[Any]) -> Number:
4343
return flop
4444

4545

46-
def addmm_flop(inputs: List[Any], outputs: List[Any]) -> Number:
46+
def addmm_flop(inputs: list[Any], outputs: list[Any]) -> Number:
4747
"""
4848
Count flops for fully connected layers.
4949
"""
@@ -60,7 +60,7 @@ def addmm_flop(inputs: List[Any], outputs: List[Any]) -> Number:
6060
return flops
6161

6262

63-
def bmm_flop(inputs: List[Any], outputs: List[Any]) -> Number:
63+
def bmm_flop(inputs: list[Any], outputs: list[Any]) -> Number:
6464
"""
6565
Count flops for the bmm operation.
6666
"""
@@ -75,9 +75,9 @@ def bmm_flop(inputs: List[Any], outputs: List[Any]) -> Number:
7575

7676

7777
def conv_flop_count(
78-
x_shape: List[int],
79-
w_shape: List[int],
80-
out_shape: List[int],
78+
x_shape: list[int],
79+
w_shape: list[int],
80+
out_shape: list[int],
8181
transposed: bool = False,
8282
) -> Number:
8383
"""
@@ -99,7 +99,7 @@ def conv_flop_count(
9999
return flop
100100

101101

102-
def conv_flop(inputs: List[Any], outputs: List[Any]):
102+
def conv_flop(inputs: list[Any], outputs: list[Any]):
103103
"""
104104
Count flops for convolution.
105105
"""
@@ -110,7 +110,7 @@ def conv_flop(inputs: List[Any], outputs: List[Any]):
110110
return conv_flop_count(x_shape, w_shape, out_shape, transposed=transposed)
111111

112112

113-
def quant_conv_flop(inputs: List[Any], outputs: List[Any]):
113+
def quant_conv_flop(inputs: list[Any], outputs: list[Any]):
114114
"""
115115
Count flops for quantized convolution.
116116
"""
@@ -124,8 +124,8 @@ def transpose_shape(shape):
124124
return [shape[1], shape[0]] + list(shape[2:])
125125

126126

127-
def conv_backward_flop(inputs: List[Any], outputs: List[Any]):
128-
grad_out_shape, x_shape, w_shape = [get_shape(i) for i in inputs[:3]]
127+
def conv_backward_flop(inputs: list[Any], outputs: list[Any]):
128+
grad_out_shape, x_shape, w_shape = (get_shape(i) for i in inputs[:3])
129129
output_mask = inputs[-1]
130130
fwd_transposed = inputs[7]
131131
flop_count = 0
@@ -140,7 +140,7 @@ def conv_backward_flop(inputs: List[Any], outputs: List[Any]):
140140
return flop_count
141141

142142

143-
def scaled_dot_product_flash_attention_flop(inputs: List[Any], outputs: List[Any]):
143+
def scaled_dot_product_flash_attention_flop(inputs: list[Any], outputs: list[Any]):
144144
# FIXME: this needs to count the flops of this kernel
145145
# https://github.com/pytorch/pytorch/blob/207b06d099def9d9476176a1842e88636c1f714f/aten/src/ATen/native/cpu/FlashAttentionKernel.cpp#L52-L267
146146
return 0

0 commit comments

Comments
 (0)