From 8b4dd510f9998ebe74516e95161997bbb5927059 Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Fri, 10 Jan 2025 07:59:10 -0800 Subject: [PATCH 1/4] Test if h265 can work on other GPU runners --- .github/workflows/linux_cuda_wheel.yaml | 2 +- test/decoders/test_video_decoder.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index c2248b88..9bfbed5b 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -56,7 +56,7 @@ jobs: build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=1 python -m build --wheel -vvv --no-isolation" install-and-test: - runs-on: linux.4xlarge.nvidia.gpu + runs-on: linux.g5.4xlarge.nvidia.gpu strategy: fail-fast: false matrix: diff --git a/test/decoders/test_video_decoder.py b/test/decoders/test_video_decoder.py index 1ff8266c..afa61737 100644 --- a/test/decoders/test_video_decoder.py +++ b/test/decoders/test_video_decoder.py @@ -426,6 +426,7 @@ def test_get_frame_played_at(self, device): assert isinstance(decoder.get_frame_played_at(6.02).pts_seconds, float) assert isinstance(decoder.get_frame_played_at(6.02).duration_seconds, float) + @pytest.mark.parametrize("device", cpu_and_cuda()) def test_get_frame_played_at_h265(self): # Non-regression test for https://github.com/pytorch/torchcodec/issues/179 # We don't parametrize with CUDA because the current GPUs on CI do not From bbad5359b0ce788210c3f57859a78ace03133998 Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Fri, 10 Jan 2025 08:45:06 -0800 Subject: [PATCH 2/4] Add device param --- test/decoders/test_video_decoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/decoders/test_video_decoder.py b/test/decoders/test_video_decoder.py index afa61737..8b3fca3e 100644 --- a/test/decoders/test_video_decoder.py +++ b/test/decoders/test_video_decoder.py @@ -427,12 +427,12 @@ def test_get_frame_played_at(self, device): assert isinstance(decoder.get_frame_played_at(6.02).duration_seconds, float) @pytest.mark.parametrize("device", cpu_and_cuda()) - def test_get_frame_played_at_h265(self): + def test_get_frame_played_at_h265(self, device): # Non-regression test for https://github.com/pytorch/torchcodec/issues/179 # We don't parametrize with CUDA because the current GPUs on CI do not # support x265: # https://github.com/pytorch/torchcodec/pull/350#issuecomment-2465011730 - decoder = VideoDecoder(H265_VIDEO.path) + decoder = VideoDecoder(H265_VIDEO.path, device=device) ref_frame6 = H265_VIDEO.get_frame_data_by_index(5) assert_frames_equal(ref_frame6, decoder.get_frame_played_at(0.5).data) From 206d1f46359076fd37ca7d55a290329c009b7982 Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Wed, 15 Jan 2025 13:13:42 -0800 Subject: [PATCH 3/4] Remove comment --- test/decoders/test_video_decoder.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/decoders/test_video_decoder.py b/test/decoders/test_video_decoder.py index dea38bab..8b15c1a3 100644 --- a/test/decoders/test_video_decoder.py +++ b/test/decoders/test_video_decoder.py @@ -446,9 +446,6 @@ def test_get_frame_played_at(self, device): @pytest.mark.parametrize("device", cpu_and_cuda()) def test_get_frame_played_at_h265(self, device): # Non-regression test for https://github.com/pytorch/torchcodec/issues/179 - # We don't parametrize with CUDA because the current GPUs on CI do not - # support x265: - # https://github.com/pytorch/torchcodec/pull/350#issuecomment-2465011730 decoder = VideoDecoder(H265_VIDEO.path, device=device) ref_frame6 = H265_VIDEO.get_frame_data_by_index(5) assert_frames_equal(ref_frame6, decoder.get_frame_played_at(0.5).data) From 35008383df2b096c3838b28133c64464e44abadd Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Wed, 15 Jan 2025 14:02:06 -0800 Subject: [PATCH 4/4] Reference must be on device --- test/decoders/test_video_decoder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/decoders/test_video_decoder.py b/test/decoders/test_video_decoder.py index 8b15c1a3..4632e5ff 100644 --- a/test/decoders/test_video_decoder.py +++ b/test/decoders/test_video_decoder.py @@ -448,7 +448,9 @@ def test_get_frame_played_at_h265(self, device): # Non-regression test for https://github.com/pytorch/torchcodec/issues/179 decoder = VideoDecoder(H265_VIDEO.path, device=device) ref_frame6 = H265_VIDEO.get_frame_data_by_index(5) - assert_frames_equal(ref_frame6, decoder.get_frame_played_at(0.5).data) + assert_frames_equal( + ref_frame6.to(device=device), decoder.get_frame_played_at(0.5).data + ) @pytest.mark.parametrize("device", cpu_and_cuda()) def test_get_frame_played_at_fails(self, device):