From 5a6b5647cf1881d930228996941b7c51000b8a9c Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Fri, 12 Sep 2025 19:18:57 +0300 Subject: [PATCH 1/5] Add missing torchcodec dependency to Windows CI installation script. --- .github/scripts/unittest-windows/install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/unittest-windows/install.sh b/.github/scripts/unittest-windows/install.sh index 73934b8fd0..57e4335f05 100644 --- a/.github/scripts/unittest-windows/install.sh +++ b/.github/scripts/unittest-windows/install.sh @@ -30,7 +30,10 @@ else wheel="cu$(python -c "print(''.join(\"${CUDA_VERSION}\".split('.')[:2]))")" fi printf "Installing PyTorch\n" -pip install --pre torch --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} +pip install --pre torch torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} + +python -c "import torch; print(torch.__version__)" +python -c "import torchcodec; print(torchcodec.__version__)" torch_cuda=$(python -c "import torch; print(torch.cuda.is_available())") echo torch.cuda.is_available is $torch_cuda From 0991164772677739f3418c9ed8714abe2c9c0253 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Fri, 12 Sep 2025 19:51:39 +0300 Subject: [PATCH 2/5] Install torchcodec from conda-forge for Windows+CUDA jobs --- .github/scripts/unittest-windows/install.sh | 14 ++++++++++++-- .github/workflows/unittest-windows-cpu.yml | 6 +++--- .github/workflows/unittest-windows-gpu.yml | 8 ++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/scripts/unittest-windows/install.sh b/.github/scripts/unittest-windows/install.sh index 57e4335f05..052e87e1e7 100644 --- a/.github/scripts/unittest-windows/install.sh +++ b/.github/scripts/unittest-windows/install.sh @@ -26,14 +26,15 @@ pip install numpy # 1. Install PyTorch if [ -z "${CUDA_VERSION:-}" ] ; then wheel="cpu" + cwheel="cpu" else wheel="cu$(python -c "print(''.join(\"${CUDA_VERSION}\".split('.')[:2]))")" + cwheel="cuda$(python -c "print(''.join(\"${CUDA_VERSION}\".split('.')[:2]))")" fi printf "Installing PyTorch\n" -pip install --pre torch torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} +pip install --pre torch --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} python -c "import torch; print(torch.__version__)" -python -c "import torchcodec; print(torchcodec.__version__)" torch_cuda=$(python -c "import torch; print(torch.cuda.is_available())") echo torch.cuda.is_available is $torch_cuda @@ -45,6 +46,15 @@ if [ ! -z "${CUDA_VERSION:-}" ] ; then fi fi +printf "Installing TorchCodec\n" +if [ "$torch_cuda" == "False" ]; then + pip install --pre torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} +else + # torchcodec nightly has no Windows+CUDA wheels + conda install -y -c conda-forge "torchcodec=*=*${cwheel}*" +fi +python -c "import torchcodec; print(torchcodec.__version__)" + # 2. Install torchaudio printf "* Installing fsspec\n" # TODO: is this required for torchaudio?? pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org fsspec diff --git a/.github/workflows/unittest-windows-cpu.yml b/.github/workflows/unittest-windows-cpu.yml index f6a786fcc1..3b872a4715 100644 --- a/.github/workflows/unittest-windows-cpu.yml +++ b/.github/workflows/unittest-windows-cpu.yml @@ -1,4 +1,4 @@ -name: Unittests on Windows CPU +name: Unit-tests on Windows CPU on: pull_request: @@ -10,7 +10,7 @@ on: workflow_dispatch: jobs: - unittests-windows-cpu: + build: uses: pytorch/test-infra/.github/workflows/windows_job.yml@main with: repository: pytorch/audio @@ -21,7 +21,7 @@ jobs: git config --global --add safe.directory /__w/audio/audio # Set up Environment Variables - export PYTHON_VERSION="3.10" + export PYTHON_VERSION="3.11" export PIP_PROGRESS_BAR=off export CONDA_QUIET=1 unset CUDA_VERSION diff --git a/.github/workflows/unittest-windows-gpu.yml b/.github/workflows/unittest-windows-gpu.yml index b00a512956..813e477a47 100644 --- a/.github/workflows/unittest-windows-gpu.yml +++ b/.github/workflows/unittest-windows-gpu.yml @@ -1,4 +1,4 @@ -name: Unittests on Windows GPU +name: Unit-tests on Windows GPU on: pull_request: @@ -10,7 +10,7 @@ on: workflow_dispatch: jobs: - unittests-windows-gpu: + build: uses: pytorch/test-infra/.github/workflows/windows_job.yml@main with: repository: pytorch/audio @@ -21,8 +21,8 @@ jobs: git config --global --add safe.directory /__w/audio/audio # Set up Environment Variables - export PYTHON_VERSION="3.10" - export CUDA_VERSION=12.6 + export PYTHON_VERSION="3.11" + export CUDA_VERSION=12.8 export PIP_PROGRESS_BAR=off export CONDA_QUIET=1 export USE_CUDA=1 From dd9a04808b4f5fa88b5f5d7d97d301c00c18e786 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Fri, 12 Sep 2025 19:54:18 +0300 Subject: [PATCH 3/5] Windows: install ffmpeg from conda --- .github/scripts/unittest-windows/setup_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/unittest-windows/setup_env.sh b/.github/scripts/unittest-windows/setup_env.sh index 8203a1d978..efea89f548 100644 --- a/.github/scripts/unittest-windows/setup_env.sh +++ b/.github/scripts/unittest-windows/setup_env.sh @@ -36,4 +36,4 @@ fi conda activate "${env_dir}" # 3. Install minimal build tools -conda install -y -c conda-forge cmake ninja +conda install -y -c conda-forge cmake ninja "ffmpeg<8" From d9675b70e3e1121cb10007a66defda26cc6a4d2a Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Fri, 12 Sep 2025 21:37:38 +0300 Subject: [PATCH 4/5] Try CPU torchcodec on Windows w/ CUDA --- .github/scripts/unittest-windows/install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/scripts/unittest-windows/install.sh b/.github/scripts/unittest-windows/install.sh index 052e87e1e7..48740fc741 100644 --- a/.github/scripts/unittest-windows/install.sh +++ b/.github/scripts/unittest-windows/install.sh @@ -46,14 +46,16 @@ if [ ! -z "${CUDA_VERSION:-}" ] ; then fi fi -printf "Installing TorchCodec\n" if [ "$torch_cuda" == "False" ]; then + printf "Installing TorchCodec\n" pip install --pre torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} + python -c "import torchcodec; print(torchcodec.__version__)" else # torchcodec nightly has no Windows+CUDA wheels - conda install -y -c conda-forge "torchcodec=*=*${cwheel}*" + printf "Warning: TorchCodec is unavailable\n" + pip install --pre torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu + python -c "import torchcodec; print(torchcodec.__version__)" fi -python -c "import torchcodec; print(torchcodec.__version__)" # 2. Install torchaudio printf "* Installing fsspec\n" # TODO: is this required for torchaudio?? From 909ff5f17de905d7c498285d73d55d984aae28f5 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Fri, 12 Sep 2025 23:01:36 +0300 Subject: [PATCH 5/5] Clean up --- .github/scripts/unittest-windows/install.sh | 17 +++++------------ .github/scripts/unittest-windows/run_test.sh | 6 +++++- .github/workflows/unittest-windows-gpu.yml | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/scripts/unittest-windows/install.sh b/.github/scripts/unittest-windows/install.sh index 48740fc741..8cc7c10df0 100644 --- a/.github/scripts/unittest-windows/install.sh +++ b/.github/scripts/unittest-windows/install.sh @@ -26,10 +26,8 @@ pip install numpy # 1. Install PyTorch if [ -z "${CUDA_VERSION:-}" ] ; then wheel="cpu" - cwheel="cpu" else wheel="cu$(python -c "print(''.join(\"${CUDA_VERSION}\".split('.')[:2]))")" - cwheel="cuda$(python -c "print(''.join(\"${CUDA_VERSION}\".split('.')[:2]))")" fi printf "Installing PyTorch\n" pip install --pre torch --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} @@ -46,16 +44,11 @@ if [ ! -z "${CUDA_VERSION:-}" ] ; then fi fi -if [ "$torch_cuda" == "False" ]; then - printf "Installing TorchCodec\n" - pip install --pre torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/${wheel} - python -c "import torchcodec; print(torchcodec.__version__)" -else - # torchcodec nightly has no Windows+CUDA wheels - printf "Warning: TorchCodec is unavailable\n" - pip install --pre torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu - python -c "import torchcodec; print(torchcodec.__version__)" -fi +printf "Installing TorchCodec\n" +# torchcodec nightly has no Windows+CUDA wheels, so we'll use CPU-only +# torchcodec also under CUDA-enabled torch: +pip install --pre torchcodec --index-url https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu +python -c "import torchcodec; print(torchcodec.__version__)" # 2. Install torchaudio printf "* Installing fsspec\n" # TODO: is this required for torchaudio?? diff --git a/.github/scripts/unittest-windows/run_test.sh b/.github/scripts/unittest-windows/run_test.sh index 25d8e14196..292fe1d2b0 100644 --- a/.github/scripts/unittest-windows/run_test.sh +++ b/.github/scripts/unittest-windows/run_test.sh @@ -12,5 +12,9 @@ python -m torch.utils.collect_env env | grep TORCHAUDIO || true cd test -pytest --continue-on-collection-errors --cov=torchaudio --junitxml=${RUNNER_TEST_RESULTS_DIR}/junit.xml -v --durations 20 torchaudio_unittest -k "not torchscript and not fairseq and not demucs and not librosa" +if [ -z "${CUDA_VERSION:-}" ] ; then + pytest --continue-on-collection-errors --cov=torchaudio --junitxml=${RUNNER_TEST_RESULTS_DIR}/junit.xml -v --durations 20 torchaudio_unittest -k "not torchscript and not fairseq and not demucs and not librosa" +else + pytest --continue-on-collection-errors --cov=torchaudio --junitxml=${RUNNER_TEST_RESULTS_DIR}/junit.xml -v --durations 20 torchaudio_unittest -k "not cpu and (cuda or gpu) and not torchscript and not fairseq and not demucs and not librosa" +fi coverage html diff --git a/.github/workflows/unittest-windows-gpu.yml b/.github/workflows/unittest-windows-gpu.yml index 813e477a47..2b0e66c171 100644 --- a/.github/workflows/unittest-windows-gpu.yml +++ b/.github/workflows/unittest-windows-gpu.yml @@ -21,8 +21,8 @@ jobs: git config --global --add safe.directory /__w/audio/audio # Set up Environment Variables - export PYTHON_VERSION="3.11" - export CUDA_VERSION=12.8 + export PYTHON_VERSION="3.10" + export CUDA_VERSION=12.6 export PIP_PROGRESS_BAR=off export CONDA_QUIET=1 export USE_CUDA=1