Skip to content

Commit efe305f

Browse files
committed
Merge branch 'main' of github.com:pytorch/torchcodec into framebatch3d
2 parents df7a464 + afc20b8 commit efe305f

27 files changed

+1086
-667
lines changed

.github/workflows/build_ffmpeg.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ name: Build non-GPL FFmpeg from source
1111

1212
on:
1313
workflow_dispatch:
14+
pull_request:
15+
paths:
16+
- packaging/build_ffmpeg.sh
1417
schedule:
1518
- cron: '0 0 * * 0' # on sunday
1619

@@ -46,13 +49,12 @@ jobs:
4649
fail-fast: false
4750
matrix:
4851
ffmpeg-version: ["4.4.4", "5.1.4", "6.1.1", "7.0.1"]
49-
runner: ["macos-m1-stable"]
5052
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
5153
with:
5254
job-name: Build
5355
upload-artifact: ffmpeg-lgpl
5456
repository: pytorch/torchcodec
55-
runner: "${{ matrix.runner }}"
57+
runner: macos-14-xlarge
5658
script: |
5759
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
5860
export FFMPEG_ROOT="${PWD}/ffmpeg"

.github/workflows/cuda_tests.yaml

Lines changed: 0 additions & 76 deletions
This file was deleted.

.github/workflows/linux_cuda_wheel.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,25 @@ jobs:
8282
name: pytorch_torchcodec__3.9_cu${{ env.cuda_version_without_periods }}_x86_64
8383
path: pytorch/torchcodec/dist/
8484
- name: Setup miniconda using test-infra
85-
uses: ahmadsharif1/test-infra/.github/actions/setup-miniconda@14bc3c29f88d13b0237ab4ddf00aa409e45ade40
85+
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
8686
with:
8787
python-version: ${{ matrix.python-version }}
88-
default-packages: "conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}"
88+
#
89+
# For some reason nvidia::libnpp=12.4 doesn't install but nvidia/label/cuda-12.4.0::libnpp does.
90+
# So we use the latter convention for libnpp.
91+
# We install conda packages at the start because otherwise conda may have conflicts with dependencies.
92+
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 }}"
8993
- name: Check env
9094
run: |
9195
${CONDA_RUN} env
9296
${CONDA_RUN} conda info
9397
${CONDA_RUN} nvidia-smi
98+
${CONDA_RUN} conda list
9499
- name: Update pip
95100
run: ${CONDA_RUN} python -m pip install --upgrade pip
96101
- name: Install PyTorch
97102
run: |
98-
${CONDA_RUN} python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }}
103+
${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }}
99104
${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")'
100105
- name: Install torchcodec from the wheel
101106
run: |
@@ -106,14 +111,8 @@ jobs:
106111
- name: Check out repo
107112
uses: actions/checkout@v3
108113

109-
- name: Install cuda runtime dependencies
110-
run: |
111-
# For some reason nvidia::libnpp=12.4 doesn't install but nvidia/label/cuda-12.4.0::libnpp does.
112-
# So we use the latter convention for libnpp.
113-
${CONDA_RUN} conda install --yes 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 }}
114114
- name: Install test dependencies
115115
run: |
116-
${CONDA_RUN} python -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
117116
# Ideally we would find a way to get those dependencies from pyproject.toml
118117
${CONDA_RUN} python -m pip install numpy pytest pillow
119118
@@ -136,8 +135,7 @@ jobs:
136135
${CONDA_RUN} python test/decoders/manual_smoke_test.py
137136
- name: Run Python tests
138137
run: |
139-
# We skip test_get_ffmpeg_version because it may not have a micro version.
140-
${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest test -k "not test_get_ffmpeg_version" -vvv
138+
${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest test -vvv
141139
- name: Run Python benchmark
142140
run: |
143141
${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none

.github/workflows/linux_wheel.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and test Linux wheels
1+
name: Build and test Linux wheel
22

33
on:
44
pull_request:
@@ -24,6 +24,7 @@ defaults:
2424
shell: bash -l -eo pipefail {0}
2525

2626
jobs:
27+
2728
generate-matrix:
2829
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
2930
with:
@@ -34,11 +35,13 @@ jobs:
3435
with-xpu: disable
3536
with-rocm: disable
3637
with-cuda: disable
38+
build-python-only: "disable"
39+
3740
build:
3841
needs: generate-matrix
3942
strategy:
4043
fail-fast: false
41-
name: Build and Upload wheel
44+
name: Build and Upload Linux wheel
4245
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
4346
with:
4447
repository: pytorch/torchcodec
@@ -60,7 +63,6 @@ jobs:
6063
matrix:
6164
python-version: ['3.9']
6265
ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1']
63-
if: ${{ always() }}
6466
needs: build
6567
steps:
6668
- uses: actions/download-artifact@v3
@@ -121,7 +123,7 @@ jobs:
121123
ls
122124
- name: Smoke test
123125
run: |
124-
python test/decoders/manual_smoke_test.py
126+
python -X faulthandler test/decoders/manual_smoke_test.py
125127
- name: Run Python tests
126128
run: |
127129
pytest test -vvv

.github/workflows/macos_wheel.yaml

Lines changed: 72 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and test MacOS
1+
name: Build and test MacOS wheel
22

33
on:
44
pull_request:
@@ -24,15 +24,54 @@ defaults:
2424
shell: bash -l -eo pipefail {0}
2525

2626
jobs:
27+
28+
generate-matrix:
29+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
30+
with:
31+
package-type: wheel
32+
os: macos-arm64
33+
test-infra-repository: pytorch/test-infra
34+
test-infra-ref: main
35+
with-xpu: disable
36+
with-rocm: disable
37+
with-cuda: disable
38+
build-python-only: "disable"
39+
40+
build:
41+
needs: generate-matrix
42+
strategy:
43+
fail-fast: false
44+
name: Build and Upload Mac wheel
45+
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
46+
with:
47+
repository: pytorch/torchcodec
48+
ref: ""
49+
test-infra-repository: pytorch/test-infra
50+
test-infra-ref: main
51+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
52+
post-script: packaging/post_build_script.sh
53+
smoke-test-script: packaging/fake_smoke_test.py
54+
runner-type: macos-m1-stable
55+
package-name: torchcodec
56+
trigger-event: ${{ github.event_name }}
57+
build-platform: "python-build-package"
58+
build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build --wheel -vvv --no-isolation"
59+
2760
install-and-test:
28-
runs-on: macos-m1-stable
61+
runs-on: macos-14-xlarge
2962
strategy:
3063
fail-fast: false
3164
matrix:
3265
python-version: ['3.9']
3366
ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1']
34-
if: ${{ always() }}
67+
needs: build
3568
steps:
69+
- name: Download wheel
70+
uses: actions/download-artifact@v3
71+
with:
72+
name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_
73+
path: pytorch/torchcodec/dist/
74+
3675
- name: Setup conda env
3776
uses: conda-incubator/setup-miniconda@v3
3877
with:
@@ -42,36 +81,49 @@ jobs:
4281
python-version: ${{ matrix.python-version }}
4382
- name: Update pip
4483
run: python -m pip install --upgrade pip
84+
4585
- name: Install PyTorch
4686
run: |
4787
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
48-
- name: Check out repo
88+
89+
- name: Install torchcodec from the wheel
90+
run: |
91+
wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
92+
echo Installing $wheel_path
93+
python -m pip install $wheel_path -vvv
94+
95+
- name: Check out torchcodec repo
4996
uses: actions/checkout@v3
50-
- name: Install compile from source dependencies
97+
98+
- name: Install ffmpeg
5199
run: |
52-
conda install cmake pkg-config -c conda-forge
100+
conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
101+
ffmpeg -version
102+
53103
- name: Install test dependencies
54104
run: |
55105
python -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
56-
# Ideally we would find a way to get those dependencies from pyproject.toml
57106
python -m pip install numpy pytest pillow
58-
- name: Install torchcodec from source, building against non-GPL FFmpeg
59-
run: |
60-
BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 pip install -e ".[dev]" --no-build-isolation
61-
- name: Install ffmpeg, post build
107+
108+
- name: Delete the src/ folder just for fun
62109
run: |
63-
# Ideally we would have checked for that before installing the wheel,
64-
# but we need to checkout the repo to access this file, and we don't
65-
# want to checkout the repo before installing the wheel to avoid any
66-
# side-effect. It's OK.
67-
source packaging/helpers.sh
68-
assert_ffmpeg_not_installed
110+
# The only reason we checked-out the repo is to get access to the
111+
# tests. We don't care about the rest. Out of precaution, we delete
112+
# the src/ folder to be extra sure that we're running the code from
113+
# the installed wheel rather than from the source.
114+
# This is just to be extra cautious and very overkill because a)
115+
# there's no way the `torchcodec` package from src/ can be found from
116+
# the PythonPath: the main point of `src/` is precisely to protect
117+
# against that and b) if we ever were to execute code from
118+
# `src/torchcodec`, it would fail loudly because the built .so files
119+
# aren't present there.
120+
rm -r src/
121+
ls -lh
69122
70-
conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
71-
ffmpeg -version
72123
- name: Smoke test
73124
run: |
74-
python test/decoders/manual_smoke_test.py
125+
python -X faulthandler test/decoders/manual_smoke_test.py
126+
75127
- name: Run Python tests
76128
run: |
77129
pytest test -vvv
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Reference resource generation tests
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- test/generate_reference_resources.sh
8+
schedule:
9+
- cron: '0 0 * * 0' # on sunday
10+
11+
defaults:
12+
run:
13+
shell: bash -l -eo pipefail {0}
14+
15+
jobs:
16+
test-reference-resource-generation:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ['3.9']
22+
ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1']
23+
steps:
24+
- name: Setup conda env
25+
uses: conda-incubator/setup-miniconda@v2
26+
with:
27+
auto-update-conda: true
28+
miniconda-version: "latest"
29+
activate-environment: test
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install ffmpeg
33+
run: |
34+
conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
35+
ffmpeg -version
36+
37+
- name: Update pip
38+
run: python -m pip install --upgrade pip
39+
40+
- name: Instal generation dependencies
41+
run: |
42+
# Note that we're installing stable - this is for running a script where we're a normal PyTorch
43+
# user, not for building TorhCodec.
44+
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
45+
python -m pip install numpy pillow
46+
47+
- name: Check out repo
48+
uses: actions/checkout@v3
49+
50+
- name: Run generation reference resources
51+
run: |
52+
test/generate_reference_resources.sh

0 commit comments

Comments
 (0)