Skip to content

Commit f8b4945

Browse files
committed
Merge branch 'main' of github.com:pytorch/vision into improved-writevideo-doc
2 parents 585a3fe + 0534b6e commit f8b4945

Some content is hidden

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

70 files changed

+1255
-359
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
export IS_M1_CONDA_BUILD_JOB=1

.github/scripts/setup-env.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ conda create \
3030
python="${PYTHON_VERSION}" pip \
3131
ninja cmake \
3232
libpng \
33+
libwebp \
3334
'ffmpeg<4.3'
3435
conda activate ci
3536
conda install --quiet --yes libjpeg-turbo -c pytorch
36-
pip install --progress-bar=off --upgrade setuptools
37+
pip install --progress-bar=off --upgrade setuptools==72.1.0
3738

3839
# See https://github.com/pytorch/vision/issues/6790
3940
if [[ "${PYTHON_VERSION}" != "3.11" ]]; then

.github/workflows/build-cmake.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
script: |
3131
set -euo pipefail
3232
33-
export PYTHON_VERSION=3.8
33+
export PYTHON_VERSION=3.9
3434
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
3535
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
3636
@@ -50,7 +50,7 @@ jobs:
5050
script: |
5151
set -euo pipefail
5252
53-
export PYTHON_VERSION=3.8
53+
export PYTHON_VERSION=3.9
5454
export GPU_ARCH_TYPE=cpu
5555
export GPU_ARCH_VERSION=''
5656
@@ -76,7 +76,7 @@ jobs:
7676
script: |
7777
set -euo pipefail
7878
79-
export PYTHON_VERSION=3.8
79+
export PYTHON_VERSION=3.9
8080
export VC_YEAR=2022
8181
export VSDEVCMD_ARGS=""
8282
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}

.github/workflows/build-conda-m1.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
test-infra-repository: pytorch/test-infra
4343
test-infra-ref: main
4444
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
45+
env-var-script: ./.github/scripts/export_IS_M1_CONDA_BUILD_JOB.sh
4546
pre-script: ${{ matrix.pre-script }}
4647
post-script: ${{ matrix.post-script }}
4748
package-name: ${{ matrix.package-name }}

.github/workflows/build-conda-windows.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ jobs:
2828
matrix:
2929
include:
3030
- repository: pytorch/vision
31-
pre-script: packaging/pre_build_script.sh
32-
env-script: packaging/windows/internal/vc_env_helper.bat
31+
pre-script: ""
3332
post-script: ""
33+
env-script: packaging/windows/internal/vc_env_helper.bat
34+
conda-package-directory: packaging/torchvision
3435
smoke-test-script: test/smoke_test.py
3536
package-name: torchvision
3637
name: ${{ matrix.repository }}

.github/workflows/build-wheels-windows.yml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
os: windows
2626
test-infra-repository: pytorch/test-infra
2727
test-infra-ref: main
28+
with-xpu: enable
2829
build:
2930
needs: generate-matrix
3031
strategy:

.github/workflows/docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
script: |
2323
set -euo pipefail
2424
25-
export PYTHON_VERSION=3.8
25+
export PYTHON_VERSION=3.10
2626
export GPU_ARCH_TYPE=cpu
2727
export GPU_ARCH_VERSION=''
2828
./.github/scripts/setup-env.sh

.github/workflows/lint.yml

+4-12
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
echo '::group::Setup environment'
2222
CONDA_PATH=$(which conda)
2323
eval "$(${CONDA_PATH} shell.bash hook)"
24-
conda create --name ci --quiet --yes python=3.8 pip
24+
conda create --name ci --quiet --yes python=3.9 pip
2525
conda activate ci
2626
echo '::endgroup::'
2727
@@ -48,22 +48,14 @@ jobs:
4848
echo '::group::Setup environment'
4949
CONDA_PATH=$(which conda)
5050
eval "$(${CONDA_PATH} shell.bash hook)"
51-
# clang-format needs some shared libraries that conflict with the system ones. Thus, we install them from conda
52-
# and prepend the libraries to linker path to prioritize them. `ncurses=5` is only available on the conda-forge
53-
# channel. Since we are not building or testing here, this is fine.
54-
conda create --name ci --quiet --yes -c conda-forge python=3.8 ncurses=5 libgcc
51+
conda create --name ci --quiet --yes -c conda-forge python=3.9 clang-format
5552
conda activate ci
56-
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
5753
echo '::endgroup::'
5854
59-
echo '::group::Install lint tools'
60-
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o ./clang-format
61-
chmod +x ./clang-format
62-
echo '::endgroup::'
6355
6456
echo '::group::Lint C source'
6557
set +e
66-
./.github/scripts/run-clang-format.py -r torchvision/csrc --clang-format-executable ./clang-format --exclude "torchvision/csrc/io/image/cpu/giflib/*"
58+
./.github/scripts/run-clang-format.py -r torchvision/csrc --exclude "torchvision/csrc/io/image/cpu/giflib/*"
6759
6860
if [ $? -ne 0 ]; then
6961
git --no-pager diff
@@ -80,7 +72,7 @@ jobs:
8072
script: |
8173
set -euo pipefail
8274
83-
export PYTHON_VERSION=3.8
75+
export PYTHON_VERSION=3.9
8476
export GPU_ARCH_TYPE=cpu
8577
export GPU_ARCH_VERSION=''
8678

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ jobs:
1111
strategy:
1212
matrix:
1313
python-version:
14-
- "3.8"
1514
- "3.9"
1615
- "3.10"
1716
- "3.11"
1817
- "3.12"
1918
runner: ["linux.12xlarge"]
2019
gpu-arch-type: ["cpu"]
2120
include:
22-
- python-version: "3.8"
21+
- python-version: "3.9"
2322
runner: linux.g5.4xlarge.nvidia.gpu
2423
gpu-arch-type: cuda
2524
gpu-arch-version: "11.8"

.github/workflows/tests-schedule.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up python
1919
uses: actions/setup-python@v2
2020
with:
21-
python-version: 3.8
21+
python-version: 3.9
2222

2323
- name: Upgrade system packages
2424
run: python -m pip install --upgrade pip setuptools wheel

.github/workflows/tests.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ jobs:
1414
strategy:
1515
matrix:
1616
python-version:
17-
- "3.8"
1817
- "3.9"
1918
- "3.10"
2019
- "3.11"
2120
- "3.12"
2221
runner: ["linux.12xlarge"]
2322
gpu-arch-type: ["cpu"]
2423
include:
25-
- python-version: 3.8
24+
- python-version: 3.9
2625
runner: linux.g5.4xlarge.nvidia.gpu
2726
gpu-arch-type: cuda
2827
gpu-arch-version: "11.8"
@@ -48,7 +47,6 @@ jobs:
4847
strategy:
4948
matrix:
5049
python-version:
51-
- "3.8"
5250
- "3.9"
5351
- "3.10"
5452
- "3.11"
@@ -74,15 +72,14 @@ jobs:
7472
strategy:
7573
matrix:
7674
python-version:
77-
- "3.8"
7875
- "3.9"
7976
- "3.10"
8077
- "3.11"
8178
- "3.12"
8279
runner: ["windows.4xlarge"]
8380
gpu-arch-type: ["cpu"]
8481
include:
85-
- python-version: "3.8"
82+
- python-version: "3.9"
8683
runner: windows.g5.4xlarge.nvidia.gpu
8784
gpu-arch-type: cuda
8885
gpu-arch-version: "11.8"
@@ -114,7 +111,7 @@ jobs:
114111
script: |
115112
set -euo pipefail
116113
117-
export PYTHON_VERSION=3.8
114+
export PYTHON_VERSION=3.10
118115
export GPU_ARCH_TYPE=cpu
119116
export GPU_ARCH_VERSION=''
120117
@@ -130,7 +127,7 @@ jobs:
130127
echo '::endgroup::'
131128
132129
echo '::group::Install testing utilities'
133-
pip install --progress-bar=off pytest
130+
pip install --progress-bar=off pytest "numpy<2"
134131
echo '::endgroup::'
135132
136133
echo '::group::Run ONNX tests'
@@ -139,13 +136,14 @@ jobs:
139136
140137
unittests-extended:
141138
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
139+
if: contains(github.event.pull_request.labels.*.name, 'run-extended')
142140
with:
143141
repository: pytorch/vision
144142
test-infra-ref: main
145143
script: |
146144
set -euo pipefail
147145
148-
export PYTHON_VERSION=3.8
146+
export PYTHON_VERSION=3.9
149147
export GPU_ARCH_TYPE=cpu
150148
export GPU_ARCH_VERSION=''
151149

.github/workflows/update-viablestrict.yml

-24
This file was deleted.

CMakeLists.txt

+32
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ option(WITH_CUDA "Enable CUDA support" OFF)
77
option(WITH_MPS "Enable MPS support" OFF)
88
option(WITH_PNG "Enable features requiring LibPNG." ON)
99
option(WITH_JPEG "Enable features requiring LibJPEG." ON)
10+
# Libwebp is disabled by default, which means enabling it from cmake is largely
11+
# untested. Since building from cmake is very low pri anyway, this is OK. If
12+
# you're a user and you need this, please open an issue (and a PR!).
13+
option(WITH_WEBP "Enable features requiring LibWEBP." OFF)
14+
# Same here
15+
option(WITH_AVIF "Enable features requiring LibAVIF." OFF)
1016

1117
if(WITH_CUDA)
1218
enable_language(CUDA)
@@ -32,6 +38,16 @@ if (WITH_JPEG)
3238
find_package(JPEG REQUIRED)
3339
endif()
3440

41+
if (WITH_WEBP)
42+
add_definitions(-DWEBP_FOUND)
43+
find_package(WEBP REQUIRED)
44+
endif()
45+
46+
if (WITH_AVIF)
47+
add_definitions(-DAVIF_FOUND)
48+
find_package(AVIF REQUIRED)
49+
endif()
50+
3551
function(CUDA_CONVERT_FLAGS EXISTING_TARGET)
3652
get_property(old_flags TARGET ${EXISTING_TARGET} PROPERTY INTERFACE_COMPILE_OPTIONS)
3753
if(NOT "${old_flags}" STREQUAL "")
@@ -104,6 +120,14 @@ if (WITH_JPEG)
104120
target_link_libraries(${PROJECT_NAME} PRIVATE ${JPEG_LIBRARIES})
105121
endif()
106122

123+
if (WITH_WEBP)
124+
target_link_libraries(${PROJECT_NAME} PRIVATE ${WEBP_LIBRARIES})
125+
endif()
126+
127+
if (WITH_AVIF)
128+
target_link_libraries(${PROJECT_NAME} PRIVATE ${AVIF_LIBRARIES})
129+
endif()
130+
107131
set_target_properties(${PROJECT_NAME} PROPERTIES
108132
EXPORT_NAME TorchVision
109133
INSTALL_RPATH ${TORCH_INSTALL_PREFIX}/lib)
@@ -118,6 +142,14 @@ if (WITH_JPEG)
118142
include_directories(${JPEG_INCLUDE_DIRS})
119143
endif()
120144

145+
if (WITH_WEBP)
146+
include_directories(${WEBP_INCLUDE_DIRS})
147+
endif()
148+
149+
if (WITH_AVIF)
150+
include_directories(${AVIF_INCLUDE_DIRS})
151+
endif()
152+
121153
set(TORCHVISION_CMAKECONFIG_INSTALL_DIR "share/cmake/TorchVision" CACHE STRING "install path for TorchVisionConfig.cmake")
122154

123155
configure_package_config_file(cmake/TorchVisionConfig.cmake.in

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ versions.
2020

2121
| `torch` | `torchvision` | Python |
2222
| ------------------ | ------------------ | ------------------- |
23-
| `main` / `nightly` | `main` / `nightly` | `>=3.8`, `<=3.12` |
23+
| `main` / `nightly` | `main` / `nightly` | `>=3.9`, `<=3.12` |
24+
| `2.5` | `0.20` | `>=3.9`, `<=3.12` |
2425
| `2.4` | `0.19` | `>=3.8`, `<=3.12` |
2526
| `2.3` | `0.18` | `>=3.8`, `<=3.12` |
2627
| `2.2` | `0.17` | `>=3.8`, `<=3.11` |

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def inject_weight_metadata(app, what, name, obj, options, lines):
383383
f"``weights='DEFAULT'`` or ``weights='{str(list(obj)[0]).split('.')[1]}'``.",
384384
]
385385

386-
if obj.__doc__ != "An enumeration.":
386+
if obj.__doc__ is not None and obj.__doc__ != "An enumeration.":
387387
# We only show the custom enum doc if it was overridden. The default one from Python is "An enumeration"
388388
lines.append("")
389389
lines.append(obj.__doc__)

0 commit comments

Comments
 (0)