From 9f01734b39a0a329ab2aa95767b4611279b0b071 Mon Sep 17 00:00:00 2001 From: Sam Anklesaria Date: Tue, 9 Sep 2025 02:50:18 +0000 Subject: [PATCH 01/21] Use CI workflow based on torchcodec docs yml file --- .github/workflows/unittest-linux-cpu.yml | 133 ++++++++++++----------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 99f7875bde..eef5ba64f1 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -1,72 +1,77 @@ name: Unit-tests on Linux CPU on: - pull_request: - push: - branches: - - nightly - - main - - release/* - workflow_dispatch: - + pull_request: + push: + branches: + - nightly + - main + - release/* + workflow_dispatch: jobs: - tests: - strategy: - matrix: - # TODO all from 3.9 to 3.13 - python_version: ["3.11"] - fail-fast: false - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main - permissions: - id-token: write - contents: read - with: - runner: linux.12xlarge - repository: pytorch/audio - timeout: 120 - script: | - echo '::group::Setup Environment Variables' - # Mark Build Directory Safe - git config --global --add safe.directory /__w/audio/audio - - # Set up Environment Variables - export PYTHON_VERSION="${{ matrix.python_version }}" - export PIP_PROGRESS_BAR=off - export CONDA_QUIET=1 - export CUDA_TESTS_ONLY="0" - unset CUDA_VERSION - - # Set CHANNEL - if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then - export UPLOAD_CHANNEL=test - else - export UPLOAD_CHANNEL=nightly - fi + build: + strategy: + matrix: + # TODO add up to 3.13 + python_version: ["3.10"] + fail-fast: false + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + permissions: + id-token: write + contents: read + with: + repository: pytorch/audio + timeout: 120 + job-name: test + script: | + set -ex + # Set up Environment Variables + export PYTHON_VERSION="${{ matrix.python_version }}" + export PIP_PROGRESS_BAR=off + export CONDA_QUIET=1 - export PATH="${PWD}/third_party/install/bin/:${PATH}" - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true - echo '::endgroup::' + # Set UPLOAD_CHANNEL + if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then + export UPLOAD_CHANNEL=test + else + export UPLOAD_CHANNEL=nightly + fi - set -euxo pipefail + echo "::group::Create conda env" + # Mark Build Directory Safe + git config --global --add safe.directory /__w/audio/audio + conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" "ffmpeg=7" cmake ninja + conda activate ./ci_env + conda info - echo '::group::Install PyTorch and Torchaudio' - ./.github/scripts/unittest-linux/install.sh - echo '::endgroup::' + python -m pip install --upgrade pip - echo '::group::Run Tests' - ./.github/scripts/unittest-linux/run_test.sh - echo '::endgroup::' + echo "::endgroup::" + echo "::group::Install PyTorch and TorchCodec" + PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" + python -m pip install --progress-bar=off --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" + python -m pip install parameterized requests coverage pytest pytest-cov scipy numpy expecttest + python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' + echo "::endgroup::" + echo "::group::Build and install TorchAudio" + python -m pip install . -v --no-build-isolation + echo "::endgroup::" + echo "::group::Run Tests" + cd test + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true + pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs" + echo "::endgroup::" From 4e0f611266082f9380924d65d348a6e14edb0932 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 19:42:27 +0300 Subject: [PATCH 02/21] Copy and adjust docs workflow for linux CPU tests workflow --- .github/workflows/unittest-linux-cpu.yml | 131 ++++++++++++----------- 1 file changed, 69 insertions(+), 62 deletions(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index eef5ba64f1..a01ed1fff3 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -8,70 +8,77 @@ on: - main - release/* workflow_dispatch: + jobs: - build: - strategy: - matrix: - # TODO add up to 3.13 - python_version: ["3.10"] - fail-fast: false - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main - permissions: - id-token: write - contents: read - with: - repository: pytorch/audio - timeout: 120 - job-name: test - script: | - set -ex - # Set up Environment Variables - export PYTHON_VERSION="${{ matrix.python_version }}" - export PIP_PROGRESS_BAR=off - export CONDA_QUIET=1 + build: + strategy: + matrix: + python-version: ["3.11"] + ffmpeg-version: ["7"] + fail-fast: false + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + permissions: + id-token: write + contents: read + with: + runner: linux.4xlarge.nvidia.gpu + repository: pytorch/audio + gpu-arch-type: cpu + gpu-arch-version: + timeout: 120 + job-name: test + + script: | + set -ex + # Set up Environment Variables + export PYTHON_VERSION="${{ matrix.python-version }}" + export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}" + export PIP_PROGRESS_BAR=off + export CONDA_QUIET=1 + + # Set UPLOAD_CHANNEL + if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then + export UPLOAD_CHANNEL=test + else + export UPLOAD_CHANNEL=nightly + fi - # Set UPLOAD_CHANNEL - if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then - export UPLOAD_CHANNEL=test - else - export UPLOAD_CHANNEL=nightly - fi + echo "::group::Create conda env" + # Mark Build Directory Safe + git config --global --add safe.directory /__w/audio/audio + conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja + conda activate ./ci_env + conda info + python -m pip install --upgrade pip + echo "::endgroup::" - echo "::group::Create conda env" - # Mark Build Directory Safe - git config --global --add safe.directory /__w/audio/audio - conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" "ffmpeg=7" cmake ninja - conda activate ./ci_env - conda info + echo "::group::Install PyTorch and TorchCodec" + PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" + python -m pip install numpy + python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" + python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")")' + echo "::endgroup::" - python -m pip install --upgrade pip + echo "::group::Build and install TorchAudio" + python -m pip install . -v --no-build-isolation + echo "::endgroup::" - echo "::endgroup::" - echo "::group::Install PyTorch and TorchCodec" - PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" - python -m pip install --progress-bar=off --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" - python -m pip install parameterized requests coverage pytest pytest-cov scipy numpy expecttest - python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' - echo "::endgroup::" - echo "::group::Build and install TorchAudio" - python -m pip install . -v --no-build-isolation - echo "::endgroup::" - echo "::group::Run Tests" - cd test - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true - export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true - pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs" - echo "::endgroup::" + echo "::group::Run TorchAudio tests" + cd test + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true + pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs" + echo "::endgroup::" From b4e1c0bca4406c91a416f1c821eb8cc61cf1c434 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 19:47:38 +0300 Subject: [PATCH 03/21] Use runner linux.12xlarge --- .github/workflows/unittest-linux-cpu.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index a01ed1fff3..6ea4844172 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -1,16 +1,16 @@ name: Unit-tests on Linux CPU on: - pull_request: - push: - branches: - - nightly - - main - - release/* - workflow_dispatch: + pull_request: + push: + branches: + - nightly + - main + - release/* + workflow_dispatch: jobs: - build: + tests: strategy: matrix: python-version: ["3.11"] @@ -21,12 +21,12 @@ jobs: id-token: write contents: read with: - runner: linux.4xlarge.nvidia.gpu + runner: linux.12xlarge repository: pytorch/audio gpu-arch-type: cpu gpu-arch-version: timeout: 120 - job-name: test + job-name: linux-cpu script: | set -ex From 64120689f2462644d356bcac7cd9589f8c65b888 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 19:53:09 +0300 Subject: [PATCH 04/21] Fix type. Add ctest. --- .github/workflows/unittest-linux-cpu.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 6ea4844172..4e1d1ac73e 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -56,15 +56,22 @@ jobs: PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" python -m pip install numpy python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" - python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")")' + python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' echo "::endgroup::" echo "::group::Build and install TorchAudio" python -m pip install . -v --no-build-isolation echo "::endgroup::" + echo "::group::Run TorchAudio C tests" + (cd build/temp*/test/cpp && ctest) + echo "::endgroup::" + echo "::group::Run TorchAudio tests" - cd test + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CTC_DECODER=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_unidecode=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true + export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true @@ -80,5 +87,5 @@ jobs: export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true - pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs" + (cd test && pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs") echo "::endgroup::" From 766882b90686812989421df157e961b5b56f56c4 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 20:12:03 +0300 Subject: [PATCH 05/21] export BUILD_CPP_TEST --- .github/workflows/unittest-linux-cpu.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 4e1d1ac73e..d90dc045e1 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -60,11 +60,12 @@ jobs: echo "::endgroup::" echo "::group::Build and install TorchAudio" + export BUILD_CPP_TEST=1 python -m pip install . -v --no-build-isolation echo "::endgroup::" echo "::group::Run TorchAudio C tests" - (cd build/temp*/test/cpp && ctest) + (cd build/temp*/test/cpp && wall_collision) echo "::endgroup::" echo "::group::Run TorchAudio tests" From 414c824084b4401c14336883fd47e34cf0944582 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 20:22:47 +0300 Subject: [PATCH 06/21] Debug c tests --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index d90dc045e1..4fb2dff476 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -65,7 +65,7 @@ jobs: echo "::endgroup::" echo "::group::Run TorchAudio C tests" - (cd build/temp*/test/cpp && wall_collision) + (cd build/temp*/test/cpp && ls) echo "::endgroup::" echo "::group::Run TorchAudio tests" From 5b76652a557fb3092f0a3fd035c15464408012a3 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 20:33:50 +0300 Subject: [PATCH 07/21] Add test dependencies --- .github/workflows/unittest-linux-cpu.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 4fb2dff476..7af6144f73 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -52,9 +52,12 @@ jobs: python -m pip install --upgrade pip echo "::endgroup::" + echo "::group::Install TorchAudio test and PyTorch dependencies" + python -m pip install parameterized requests coverage pytest pytest-cov scipy numpy expecttest + echo "::endgroup::" + echo "::group::Install PyTorch and TorchCodec" PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" - python -m pip install numpy python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' echo "::endgroup::" @@ -65,7 +68,7 @@ jobs: echo "::endgroup::" echo "::group::Run TorchAudio C tests" - (cd build/temp*/test/cpp && ls) + (cd build/temp*/test/cpp && ./wall_collision) echo "::endgroup::" echo "::group::Run TorchAudio tests" From 6b20f81f8bafc4c3e1eb2bc7366b1fdfdb68a6ee Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 21:17:12 +0300 Subject: [PATCH 08/21] Use pytest -x --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 7af6144f73..64b170dc7f 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -91,5 +91,5 @@ jobs: export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true - (cd test && pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs") + pytest test/torchaudio_unittest -k "not torchscript and not fairseq and not demucs" -x echo "::endgroup::" From 55ce902876332bf0b04bf157827daa381d67368d Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 21:27:51 +0300 Subject: [PATCH 09/21] Pin to torch 2.9 --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 64b170dc7f..1abc73b3fc 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -58,7 +58,7 @@ jobs: echo "::group::Install PyTorch and TorchCodec" PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" - python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" + python -m pip install --pre torch=2.9 torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' echo "::endgroup::" From e881cf171a3e01735836e98186faa1fc8e93bb90 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 21:34:43 +0300 Subject: [PATCH 10/21] Pin to torch 2.9 --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 1abc73b3fc..b1cc237a27 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -58,7 +58,7 @@ jobs: echo "::group::Install PyTorch and TorchCodec" PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" - python -m pip install --pre torch=2.9 torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" + python -m pip install --pre "torch=2.9" torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' echo "::endgroup::" From 2a61d417fecc341f6c3ec28b532194a3e5ce6335 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 21:43:10 +0300 Subject: [PATCH 11/21] Pin to torch 2.9 --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index b1cc237a27..052dd5ac13 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -58,7 +58,7 @@ jobs: echo "::group::Install PyTorch and TorchCodec" PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" - python -m pip install --pre "torch=2.9" torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" + python -m pip install --pre "torch==2.9" torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' echo "::endgroup::" From eaf92331b40aa7e53bc1f460048c64292cc82c2e Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 21:49:15 +0300 Subject: [PATCH 12/21] Pin to torch 2.9 --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 052dd5ac13..ce5fdbf919 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -58,7 +58,7 @@ jobs: echo "::group::Install PyTorch and TorchCodec" PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" - python -m pip install --pre "torch==2.9" torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" + python -m pip install --pre "torch==2.9.*" torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' echo "::endgroup::" From 1b3a2fff82eb08e55b1688f59ff3a2f29fcb8fe3 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 22:09:36 +0300 Subject: [PATCH 13/21] Check torchcodec version --- .github/workflows/unittest-linux-cpu.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index ce5fdbf919..e4a0d4807b 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -58,8 +58,9 @@ jobs: echo "::group::Install PyTorch and TorchCodec" PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" - python -m pip install --pre "torch==2.9.*" torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" + python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' + python -c 'import torchcodec; print(f"{torchcodec.__version__}"); print(f"{torchcodec.__file__}")' echo "::endgroup::" echo "::group::Build and install TorchAudio" From ac534214aa5e55940f77bee5000060ba11dd5ccd Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 22:22:43 +0300 Subject: [PATCH 14/21] Add pybind11 --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index e4a0d4807b..4feeef921c 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -46,7 +46,7 @@ jobs: echo "::group::Create conda env" # Mark Build Directory Safe git config --global --add safe.directory /__w/audio/audio - conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja + conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja pybind11 conda activate ./ci_env conda info python -m pip install --upgrade pip From bf08494da8b935685d78f27ff740a91e9ff3732e Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 22:38:22 +0300 Subject: [PATCH 15/21] Use conda -n --- .github/workflows/unittest-linux-cpu.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 4feeef921c..530e1ce08c 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -46,9 +46,10 @@ jobs: echo "::group::Create conda env" # Mark Build Directory Safe git config --global --add safe.directory /__w/audio/audio - conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja pybind11 - conda activate ./ci_env + conda create -c conda-forge --strict-channel-priority -y -n ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja + conda activate ci_env conda info + conda list python -m pip install --upgrade pip echo "::endgroup::" From 71a988d4b1b728ac5bbd3b341eb0b71e2fd572db Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 22:49:48 +0300 Subject: [PATCH 16/21] Use runner linux.g5.4xlarge.nvidia.gpu --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 530e1ce08c..155817ab7c 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -21,7 +21,7 @@ jobs: id-token: write contents: read with: - runner: linux.12xlarge + runner: linux.g5.4xlarge.nvidia.gpu repository: pytorch/audio gpu-arch-type: cpu gpu-arch-version: From a802d62fe03074491fddbdc9be924e850fb87ae5 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Wed, 10 Sep 2025 23:35:17 +0300 Subject: [PATCH 17/21] Undo use runner linux.g5.4xlarge.nvidia.gpu --- .github/workflows/unittest-linux-cpu.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 155817ab7c..2e398e9db9 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -21,7 +21,7 @@ jobs: id-token: write contents: read with: - runner: linux.g5.4xlarge.nvidia.gpu + runner: linux.12xlarge repository: pytorch/audio gpu-arch-type: cpu gpu-arch-version: @@ -50,6 +50,7 @@ jobs: conda activate ci_env conda info conda list + ffmpeg -version python -m pip install --upgrade pip echo "::endgroup::" From eb44b5f1f65b3408d730c4057ccda3a11722d75e Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Thu, 11 Sep 2025 00:00:05 +0300 Subject: [PATCH 18/21] debug torchcodec --- .github/workflows/unittest-linux-cpu.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 2e398e9db9..5df270ac98 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -62,6 +62,8 @@ jobs: PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu" python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")' + ls -la /opt/conda/envs/ci_env/lib/python3.11/site-packages/torchcodec/ + ldd /opt/conda/envs/ci_env/lib/python3.11/site-packages/torchcodec/libtorchcodec_core7.so python -c 'import torchcodec; print(f"{torchcodec.__version__}"); print(f"{torchcodec.__file__}")' echo "::endgroup::" From e38a6f152e71dbf491b45061fbcdbe3eae23a3d1 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Thu, 11 Sep 2025 00:14:28 +0300 Subject: [PATCH 19/21] Add LD_LIBRARY_PATH --- .github/workflows/unittest-linux-cpu.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 5df270ac98..71ee1eb0ea 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -52,6 +52,8 @@ jobs: conda list ffmpeg -version python -m pip install --upgrade pip + export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH + echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" echo "::endgroup::" echo "::group::Install TorchAudio test and PyTorch dependencies" From cbddd03904ae2150ded4adcccbf4a6b5dbecd318 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Thu, 11 Sep 2025 00:19:26 +0300 Subject: [PATCH 20/21] Add LD_LIBRARY_PATH --- .github/workflows/unittest-linux-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-linux-cpu.yml b/.github/workflows/unittest-linux-cpu.yml index 71ee1eb0ea..1500038da5 100644 --- a/.github/workflows/unittest-linux-cpu.yml +++ b/.github/workflows/unittest-linux-cpu.yml @@ -52,7 +52,7 @@ jobs: conda list ffmpeg -version python -m pip install --upgrade pip - export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH + export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH} echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" echo "::endgroup::" From 0b430ddf578a1b32bc28d9e106a53024b30d728e Mon Sep 17 00:00:00 2001 From: Sam Anklesaria Date: Thu, 11 Sep 2025 03:53:35 +0000 Subject: [PATCH 21/21] Remove scipy mock of torchcodec --- test/torchcodec/decoders.py | 17 ----------------- test/torchcodec/encoders.py | 15 --------------- 2 files changed, 32 deletions(-) delete mode 100644 test/torchcodec/decoders.py delete mode 100644 test/torchcodec/encoders.py diff --git a/test/torchcodec/decoders.py b/test/torchcodec/decoders.py deleted file mode 100644 index a1f0433805..0000000000 --- a/test/torchcodec/decoders.py +++ /dev/null @@ -1,17 +0,0 @@ -from types import SimpleNamespace - -import torchaudio_unittest.common_utils.wav_utils as wav_utils - -# See corresponding [TorchCodec test dependency mocking hack] note in -# conftest.py - - -class AudioDecoder: - def __init__(self, uri): - self.uri = uri - data, sample_rate = wav_utils.load_wav(self.uri) - self.metadata = SimpleNamespace(sample_rate=sample_rate) - self.data = data - - def get_all_samples(self): - return SimpleNamespace(data=self.data) diff --git a/test/torchcodec/encoders.py b/test/torchcodec/encoders.py deleted file mode 100644 index d81cc5aa84..0000000000 --- a/test/torchcodec/encoders.py +++ /dev/null @@ -1,15 +0,0 @@ -from types import SimpleNamespace - -import torchaudio_unittest.common_utils.wav_utils as wav_utils - -# See corresponding [TorchCodec test dependency mocking hack] note in -# conftest.py - - -class AudioEncoder: - def __init__(self, data, sample_rate): - self.data = data - self.metadata = SimpleNamespace(sample_rate=sample_rate) - - def to_file(self, uri, bit_rate=None): - return wav_utils.save_wav(uri, self.data, self.metadata.sample_rate)