Skip to content

Commit b7bbfb2

Browse files
committed
Merge branch 'aeaenjfjanef' into nvdec-rework-frame-ordering
2 parents 5d194e5 + f9c7297 commit b7bbfb2

File tree

9 files changed

+37
-34
lines changed

9 files changed

+37
-34
lines changed

.github/workflows/build_ffmpeg.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
job-name: Build
3737
upload-artifact: ffmpeg-lgpl-linux_x86_64-${{ matrix.ffmpeg-version }}
38-
repository: pytorch/torchcodec
38+
repository: meta-pytorch/torchcodec
3939
script: |
4040
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
4141
export FFMPEG_ROOT="${PWD}/ffmpeg"
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
job-name: Build
5959
upload-artifact: ffmpeg-lgpl-macos-${{ matrix.ffmpeg-version }}
60-
repository: pytorch/torchcodec
60+
repository: meta-pytorch/torchcodec
6161
runner: macos-14-xlarge
6262
script: |
6363
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
@@ -80,7 +80,7 @@ jobs:
8080
with:
8181
job-name: Build
8282
upload-artifact: ffmpeg-lgpl-windows_x86_64-${{ matrix.ffmpeg-version }}
83-
repository: pytorch/torchcodec
83+
repository: meta-pytorch/torchcodec
8484
script: |
8585
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
8686
export FFMPEG_ROOT="${PWD}/ffmpeg"

.github/workflows/docs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
name: Build and Upload wheel
3434
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
3535
with:
36-
repository: pytorch/torchcodec
36+
repository: meta-pytorch/torchcodec
3737
ref: ""
3838
test-infra-repository: pytorch/test-infra
3939
test-infra-ref: main
@@ -70,7 +70,7 @@ jobs:
7070
echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV
7171
- uses: actions/download-artifact@v4
7272
with:
73-
name: pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64
73+
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64
7474
path: pytorch/torchcodec/dist/
7575
- name: Setup miniconda using test-infra
7676
uses: pytorch/test-infra/.github/actions/setup-miniconda@main

.github/workflows/linux_cuda_wheel.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
name: Build and Upload wheel
4444
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
4545
with:
46-
repository: pytorch/torchcodec
46+
repository: meta-pytorch/torchcodec
4747
ref: ""
4848
test-infra-repository: pytorch/test-infra
4949
test-infra-ref: main
@@ -86,7 +86,7 @@ jobs:
8686
echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV
8787
- uses: actions/download-artifact@v4
8888
with:
89-
name: pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64
89+
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64
9090
path: pytorch/torchcodec/dist/
9191
- name: Setup miniconda using test-infra
9292
uses: pytorch/test-infra/.github/actions/setup-miniconda@main

.github/workflows/linux_wheel.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
name: Build and Upload Linux wheel
4545
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
4646
with:
47-
repository: pytorch/torchcodec
47+
repository: meta-pytorch/torchcodec
4848
ref: ""
4949
test-infra-repository: pytorch/test-infra
5050
test-infra-ref: main
@@ -68,7 +68,7 @@ jobs:
6868
steps:
6969
- uses: actions/download-artifact@v4
7070
with:
71-
name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64
71+
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64
7272
path: pytorch/torchcodec/dist/
7373
- name: Setup conda env
7474
uses: conda-incubator/setup-miniconda@v2

.github/workflows/macos_wheel.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
name: Build and Upload Mac wheel
4545
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
4646
with:
47-
repository: pytorch/torchcodec
47+
repository: meta-pytorch/torchcodec
4848
ref: ""
4949
test-infra-repository: pytorch/test-infra
5050
test-infra-ref: main
@@ -71,7 +71,7 @@ jobs:
7171
- name: Download wheel
7272
uses: actions/download-artifact@v4
7373
with:
74-
name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_
74+
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cpu_
7575
path: pytorch/torchcodec/dist/
7676

7777
- name: Setup conda env

.github/workflows/windows_wheel.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
name: Build and Upload Windows wheel
4747
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main
4848
with:
49-
repository: pytorch/torchcodec
49+
repository: meta-pytorch/torchcodec
5050
ref: ""
5151
test-infra-repository: pytorch/test-infra
5252
test-infra-ref: main
@@ -76,7 +76,7 @@ jobs:
7676
steps:
7777
- uses: actions/download-artifact@v4
7878
with:
79-
name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x64
79+
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cpu_x64
8080
path: pytorch/torchcodec/dist/
8181
- name: Setup conda env
8282
uses: conda-incubator/setup-miniconda@v2

src/torchcodec/_samplers/video_clip_sampler.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,12 @@ class IndexBasedSamplerArgs(SamplerArgs):
105105
sample_step: int = 1
106106

107107

108-
class VideoClipSampler(nn.Module):
108+
class DEPRECATED_VideoClipSampler(nn.Module):
109109
"""
110-
VideoClipSampler will do video clip sampling with given video args and sampler args.
111-
The video args contains video related information, frames_per_clip, dimensions etc.
112-
The sampler args can be either time-based or index-based, it will be used to decide clip start time pts or index.
113-
ClipSampling support, random, uniform, periodic, target, keyframe sampling etc.
110+
DEPRECATED: Do not use. The supported samplers are in `torchcodec.samplers`. See:
114111
115-
Args:
116-
video_args (`VideoArgs`): The video args
117-
sampler_args (`SamplerArgs`): The sampler args. Can be TimeBasedSamplerArgs or IndexBasedSamplerArgs
118-
decoder_args (`DecoderArgs`): Decoder args contain value needs for decoder, for example, thread count
119-
120-
Example:
121-
>>> video_args = VideoArgs(desired_width=224, desired_height=224)
122-
>>> time_based_sampler_args = TimeBasedSamplerArgs(sampler_type="random", clips_per_video=1, frames_per_clip=4)
123-
>>> video_decoder_args = DecoderArgs(num_threads=1)
124-
>>> video_clip_sampler = VideoClipSampler(video_args, time_based_sampler_args, decoder_args)
125-
>>> clips = video_clip_sampler(video_data)
126-
clips now contains a list of clip, where clip is a list of frame tensors, each tensor represents a frame image.
112+
* https://docs.pytorch.org/torchcodec/stable/api_ref_torchcodec.html
113+
* https://docs.pytorch.org/torchcodec/stable/generated_examples/decoding/sampling.html
127114
"""
128115

129116
def __init__(

test/test_decoders.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,16 @@ def test_get_frames_at_tensor_indices(self):
14021402
decoder.get_frames_played_at(torch.tensor([0, 1], dtype=torch.int))
14031403
decoder.get_frames_played_at(torch.tensor([0, 1], dtype=torch.float))
14041404

1405+
# TODONVDEC P1 unskip equality assertion checks on FFMpeg4. The comparison
1406+
# checks are failing on very few pixels, e.g.:
1407+
#
1408+
# E Mismatched elements: 648586 / 82944000 (0.8%)
1409+
# E Greatest absolute difference: 164 at index (20, 2, 27, 96)
1410+
# E Greatest relative difference: inf at index (5, 1, 112, 186)
1411+
#
1412+
# So we're skipping them to unblock for now, but we should call
1413+
# assert_tensor_close_on_at_least or something like that.
1414+
14051415
@needs_cuda
14061416
@pytest.mark.parametrize("asset", (NASA_VIDEO, TEST_SRC_2_720P, BT709_FULL_RANGE))
14071417
@pytest.mark.parametrize("contiguous_indices", (True, False))
@@ -1424,7 +1434,10 @@ def test_beta_cuda_interface_get_frame_at(
14241434
for frame_index in indices:
14251435
ref_frame = ref_decoder.get_frame_at(frame_index)
14261436
beta_frame = beta_decoder.get_frame_at(frame_index)
1427-
torch.testing.assert_close(beta_frame.data, ref_frame.data, rtol=0, atol=0)
1437+
if get_ffmpeg_major_version() > 4: # TODONVDEC P1 see above
1438+
torch.testing.assert_close(
1439+
beta_frame.data, ref_frame.data, rtol=0, atol=0
1440+
)
14281441

14291442
assert beta_frame.pts_seconds == ref_frame.pts_seconds
14301443
assert beta_frame.duration_seconds == ref_frame.duration_seconds
@@ -1451,7 +1464,10 @@ def test_beta_cuda_interface_get_frames_at(
14511464

14521465
ref_frames = ref_decoder.get_frames_at(indices)
14531466
beta_frames = beta_decoder.get_frames_at(indices)
1454-
torch.testing.assert_close(beta_frames.data, ref_frames.data, rtol=0, atol=0)
1467+
if get_ffmpeg_major_version() > 4: # TODONVDEC P1 see above
1468+
torch.testing.assert_close(
1469+
beta_frames.data, ref_frames.data, rtol=0, atol=0
1470+
)
14551471
torch.testing.assert_close(beta_frames.pts_seconds, ref_frames.pts_seconds)
14561472
torch.testing.assert_close(
14571473
beta_frames.duration_seconds, ref_frames.duration_seconds

test/test_video_clip_sampler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import pytest
55
import torch
66
from torchcodec._samplers import (
7+
DEPRECATED_VideoClipSampler,
78
IndexBasedSamplerArgs,
89
TimeBasedSamplerArgs,
910
VideoArgs,
10-
VideoClipSampler,
1111
)
1212

1313
from .utils import NASA_VIDEO
@@ -34,7 +34,7 @@ def test_sampler(sampler_args):
3434
torch.manual_seed(0)
3535
desired_width, desired_height = 320, 240
3636
video_args = VideoArgs(desired_width=desired_width, desired_height=desired_height)
37-
sampler = VideoClipSampler(video_args, sampler_args)
37+
sampler = DEPRECATED_VideoClipSampler(video_args, sampler_args)
3838
clips = sampler(NASA_VIDEO.to_tensor())
3939
assert len(clips) == sampler_args.clips_per_video
4040
clip = clips[0]

0 commit comments

Comments
 (0)