Skip to content

Commit 21ab210

Browse files
authored
Merge branch 'main' into dropdefaultscudajob
2 parents 151efc4 + fb97dbd commit 21ab210

Some content is hidden

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

56 files changed

+2214
-686
lines changed

.github/workflows/build_ffmpeg.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,33 @@ jobs:
4848
mkdir -p "${artifact_dir}"
4949
mv ffmpeg.tar.gz "${artifact_dir}/${FFMPEG_VERSION}.tar.gz"
5050
51+
LGPL-Linux-aarch64:
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
ffmpeg-version: ["4.4.4", "5.1.4", "6.1.1", "7.0.1", "8.0"]
56+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
57+
permissions:
58+
id-token: write
59+
contents: read
60+
with:
61+
job-name: Build
62+
upload-artifact: ffmpeg-lgpl-linux_aarch64-${{ matrix.ffmpeg-version }}
63+
repository: meta-pytorch/torchcodec
64+
runner: linux.arm64.2xlarge
65+
docker-image: pytorch/manylinux2_28_aarch64-builder:cpu-aarch64
66+
script: |
67+
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
68+
export FFMPEG_ROOT="${PWD}/ffmpeg"
69+
70+
packaging/build_ffmpeg.sh
71+
72+
tar -cf ffmpeg.tar.gz ffmpeg/include ffmpeg/lib
73+
74+
artifact_dir="${RUNNER_ARTIFACT_DIR}/$(date +%Y-%m-%d)/linux_aarch64"
75+
mkdir -p "${artifact_dir}"
76+
mv ffmpeg.tar.gz "${artifact_dir}/${FFMPEG_VERSION}.tar.gz"
77+
5178
LGPL-macOS:
5279
strategy:
5380
fail-fast: false

.github/workflows/docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
${CONDA_RUN} conda info
8585
${CONDA_RUN} nvidia-smi
8686
${CONDA_RUN} conda list
87+
echo LD_LIBRARY_PATH=$CONDA_PREFIX/lib:/usr/local/cuda/lib64/:${LD_LIBRARY_PATH} >> $GITHUB_ENV
8788
- name: Assert ffmpeg exists
8889
run: |
8990
${CONDA_RUN} ffmpeg -buildconf
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and test Linux CUDA aarch64 wheels
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- nightly
8+
- main
9+
- release/*
10+
tags:
11+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
id-token: write
20+
contents: write
21+
22+
defaults:
23+
run:
24+
shell: bash -l -eo pipefail {0}
25+
26+
jobs:
27+
generate-matrix:
28+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
29+
with:
30+
package-type: wheel
31+
os: linux-aarch64
32+
test-infra-repository: pytorch/test-infra
33+
test-infra-ref: main
34+
with-cpu: disable
35+
with-xpu: disable
36+
with-rocm: disable
37+
with-cuda: enable
38+
build-python-only: "disable"
39+
build:
40+
needs: generate-matrix
41+
strategy:
42+
fail-fast: false
43+
name: Build and Upload wheel
44+
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
45+
with:
46+
repository: meta-pytorch/torchcodec
47+
ref: ""
48+
test-infra-repository: pytorch/test-infra
49+
test-infra-ref: main
50+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
51+
pre-script: packaging/pre_build_script.sh
52+
post-script: packaging/post_build_script.sh
53+
smoke-test-script: packaging/fake_smoke_test.py
54+
package-name: torchcodec
55+
trigger-event: ${{ github.event_name }}
56+
architecture: aarch64
57+
build-platform: "python-build-package"
58+
build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=1 python -m build --wheel -vvv --no-isolation"

.github/workflows/linux_cuda_wheel.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ jobs:
9999
- name: Install dependencies
100100
run: |
101101
# Note: xorg-libxau was addded to fix a problem with ffmpeg 4. We should consider removing it.
102-
conda install libnpp cuda-nvrtc=${{ matrix.cuda-version }} cuda-toolkit=${{ matrix.cuda-version }} cuda-cudart=${{ matrix.cuda-version }} cuda-driver-dev=${{ matrix.cuda-version }} ffmpeg=${{ matrix.ffmpeg-version-for-tests }} xorg-libxau
103-
- name: Check env
102+
default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }} conda-forge::xorg-libxau"
103+
- name: Check env, set LD_LIBRARY_PATH
104104
run: |
105-
env
106-
conda info
107-
nvidia-smi
108-
conda list
105+
${CONDA_RUN} env
106+
${CONDA_RUN} conda info
107+
${CONDA_RUN} nvidia-smi
108+
${CONDA_RUN} conda list
109+
echo LD_LIBRARY_PATH=$CONDA_PREFIX/lib:/usr/local/cuda/lib64/:${LD_LIBRARY_PATH} >> $GITHUB_ENV
109110
- name: Assert ffmpeg exists
110111
run: |
111112
ffmpeg -buildconf

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ repos:
1414
- id: check-added-large-files
1515
args: ['--maxkb=1000']
1616

17+
- repo: https://github.com/asottile/pyupgrade
18+
rev: v3.21.2
19+
hooks:
20+
- id: pyupgrade
21+
args: [--py310-plus]
22+
files: ^(test|src)/
23+
exclude: ^examples/
24+
1725
- repo: https://github.com/omnilib/ufmt
1826
rev: v2.6.0
1927
hooks:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Start by installing the **nightly** build of PyTorch following the
3030
Then, the easiest way to install the rest of the dependencies is to run:
3131

3232
```bash
33-
conda install cmake pkg-config pybind11 "ffmpeg<8" -c conda-forge
33+
conda install cmake pkg-config pybind11 "ffmpeg" -c conda-forge
3434
```
3535

3636
### Clone and build

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
[**Installation**](#installing-torchcodec) | [**Simple Example**](#using-torchcodec) | [**Detailed Example**](https://pytorch.org/torchcodec/stable/generated_examples/) | [**Documentation**](https://pytorch.org/torchcodec) | [**Contributing**](CONTRIBUTING.md) | [**License**](#license)
1+
[**Installation**](#installing-torchcodec) | [**Simple Example**](#using-torchcodec) | [**Detailed Example**](https://meta-pytorch.org/torchcodec/stable/generated_examples/) | [**Documentation**](https://meta-pytorch.org/torchcodec) | [**Contributing**](CONTRIBUTING.md) | [**License**](#license)
22

33
# TorchCodec
44

55
TorchCodec is a Python library for decoding video and audio data into PyTorch
6-
tensors, on CPU and CUDA GPU. It also supports audio encoding, and video
7-
encoding will come soon! It aims to be fast, easy to use, and well integrated
6+
tensors, on CPU and CUDA GPU. It also supports video and audio encoding on CPU!
7+
It aims to be fast, easy to use, and well integrated
88
into the PyTorch ecosystem. If you want to use PyTorch to train ML models on
99
videos and audio, TorchCodec is how you turn these into data.
1010

@@ -23,7 +23,7 @@ We achieve these capabilities through:
2323

2424
Here's a condensed summary of what you can do with TorchCodec. For more detailed
2525
examples, [check out our
26-
documentation](https://pytorch.org/torchcodec/stable/generated_examples/)!
26+
documentation](https://meta-pytorch.org/torchcodec/stable/generated_examples/)!
2727

2828
#### Decoding
2929

@@ -107,16 +107,16 @@ ffmpeg -f lavfi -i \
107107
`torch` and `torchcodec`.
108108

109109
2. Install FFmpeg, if it's not already installed. Linux distributions usually
110-
come with FFmpeg pre-installed. TorchCodec supports major FFmpeg versions
111-
in [4, 7] on all platforms, and FFmpeg version 8 is supported on Mac and Linux.
110+
come with FFmpeg pre-installed. TorchCodec supports supports all major FFmpeg versions
111+
in [4, 8].
112112

113113
If FFmpeg is not already installed, or you need a more recent version, an
114114
easy way to install it is to use `conda`:
115115

116116
```bash
117-
conda install "ffmpeg<8"
117+
conda install "ffmpeg"
118118
# or
119-
conda install "ffmpeg<8" -c conda-forge
119+
conda install "ffmpeg" -c conda-forge
120120
```
121121

122122
3. Install TorchCodec:
@@ -130,7 +130,8 @@ The following table indicates the compatibility between versions of
130130

131131
| `torchcodec` | `torch` | Python |
132132
| ------------------ | ------------------ | ------------------- |
133-
| `main` / `nightly` | `main` / `nightly` | `>=3.10`, `<=3.13` |
133+
| `main` / `nightly` | `main` / `nightly` | `>=3.10`, `<=3.14` |
134+
| `0.9` | `2.9` | `>=3.10`, `<=3.14` |
134135
| `0.8` | `2.9` | `>=3.10`, `<=3.13` |
135136
| `0.7` | `2.8` | `>=3.9`, `<=3.13` |
136137
| `0.6` | `2.8` | `>=3.9`, `<=3.13` |
@@ -148,16 +149,15 @@ format you want. Refer to Nvidia's GPU support matrix for more details
148149
[here](https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new).
149150

150151
1. Install FFmpeg with NVDEC support.
151-
TorchCodec with CUDA should work with FFmpeg versions in [4, 7] on all platforms,
152-
and FFmpeg version 8 is supported on Linux.
152+
TorchCodec with CUDA should work with FFmpeg versions in [4, 8].
153153

154154
If FFmpeg is not already installed, or you need a more recent version, an
155155
easy way to install it is to use `conda`:
156156

157157
```bash
158-
conda install "ffmpeg<8"
158+
conda install "ffmpeg"
159159
# or
160-
conda install "ffmpeg<8" -c conda-forge
160+
conda install "ffmpeg" -c conda-forge
161161
```
162162

163163
After installing FFmpeg make sure it has NVDEC support when you list the supported
@@ -219,7 +219,7 @@ The bottom row is [promotional video from NASA](https://download.pytorch.org/tor
219219
that has a resolution of 960x540 at 29.7 fps and is 206 seconds long. Both videos were
220220
encoded with libx264 and yuv420p pixel format. All decoders, except for TorchVision, used FFmpeg 6.1.2. TorchVision used FFmpeg 4.2.2.
221221

222-
For TorchCodec, the "approx" label means that it was using [approximate mode](https://pytorch.org/torchcodec/stable/generated_examples/approximate_mode.html)
222+
For TorchCodec, the "approx" label means that it was using [approximate mode](https://meta-pytorch.org/torchcodec/stable/generated_examples/decoding/approximate_mode.html)
223223
for seeking.
224224

225225
## Contributing

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sphinx==5.0.0
33
sphinx_design
44
sphinx_copybutton
55
sphinx-tabs
6+
sphinx-sitemap
67
matplotlib
78
torchvision
89
ipython

docs/source/api_ref_encoders.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ For an audio decoder tutorial, see: :ref:`sphx_glr_generated_examples_encoding_a
1616
:template: class.rst
1717

1818
AudioEncoder
19+
VideoEncoder

docs/source/api_ref_transforms.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ For a tutorial, see: TODO_DECODER_TRANSFORMS_TUTORIAL.
1414
:template: dataclass.rst
1515

1616
DecoderTransform
17+
CenterCrop
18+
RandomCrop
1719
Resize

0 commit comments

Comments
 (0)