Skip to content

Commit 46aac18

Browse files
author
pytorchbot
committed
2024-10-29 nightly release (d1b3daf)
1 parent 97a2172 commit 46aac18

27 files changed

+1050
-673
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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ jobs:
135135
${CONDA_RUN} python test/decoders/manual_smoke_test.py
136136
- name: Run Python tests
137137
run: |
138-
# We skip test_get_ffmpeg_version because it may not have a micro version.
139-
${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
140139
- name: Run Python benchmark
141140
run: |
142141
${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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ decoder.get_frame_at(len(decoder) - 1)
6565
# pts_seconds: 9.960000038146973
6666
# duration_seconds: 0.03999999910593033
6767

68-
decoder.get_frames_at(start=10, stop=30, step=5)
68+
decoder.get_frames_in_range(start=10, stop=30, step=5)
6969
# FrameBatch:
7070
# data (shape): torch.Size([4, 3, 400, 640])
7171
# pts_seconds: tensor([0.4000, 0.6000, 0.8000, 1.0000])
7272
# duration_seconds: tensor([0.0400, 0.0400, 0.0400, 0.0400])
7373

7474
# Time-based indexing with PTS and duration info
75-
decoder.get_frame_displayed_at(pts_seconds=2)
75+
decoder.get_frame_played_at(pts_seconds=2)
7676
# Frame:
7777
# data (shape): torch.Size([3, 400, 640])
7878
# pts_seconds: 2.0

0 commit comments

Comments
 (0)