Skip to content

Commit 7260d09

Browse files
authored
Add missing torchcodec dependency to MacOS M1 workflow. (#4108)
1 parent 0e72a50 commit 7260d09

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

.github/workflows/unittest-macos-cpu.yml

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ on:
99
- release/*
1010
workflow_dispatch:
1111

12-
env:
13-
CHANNEL: "nightly"
14-
1512
jobs:
16-
tests:
13+
build:
14+
strategy:
15+
matrix:
16+
python-version: ["3.11"]
17+
ffmpeg-version: ["7"]
18+
fail-fast: false
1719
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
20+
permissions:
21+
id-token: write
22+
contents: read
1823
with:
1924
runner: macos-m1-stable
2025
repository: pytorch/audio
@@ -25,13 +30,12 @@ jobs:
2530
git config --global --add safe.directory /__w/audio/audio
2631
2732
# Set up Environment Variables
28-
export PYTHON_VERSION="3.10"
33+
export PYTHON_VERSION="${{ matrix.python-version }}"
34+
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
2935
export PIP_PROGRESS_BAR=off
3036
export CONDA_QUIET=1
3137
export CU_VERSION=""
32-
export CUDATOOLKIT=""
3338
export USE_OPENMP="0"
34-
unset CUDA_VERSION
3539
3640
# Set CHANNEL
3741
if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
@@ -40,6 +44,37 @@ jobs:
4044
export UPLOAD_CHANNEL=nightly
4145
fi
4246
47+
echo "::group::Create conda environment"
48+
# Mark Build Directory Safe
49+
git config --global --add safe.directory /__w/audio/audio
50+
conda create -c conda-forge --strict-channel-priority -y -n ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja
51+
conda activate ci_env
52+
conda info
53+
ffmpeg -version
54+
python -m pip install --upgrade pip
55+
echo "::endgroup::"
56+
57+
echo "::group::Install TorchAudio test and PyTorch dependencies"
58+
python -m pip install parameterized requests coverage pytest pytest-cov scipy numpy expecttest
59+
echo "::endgroup::"
60+
61+
echo "::group::Install PyTorch and TorchCodec"
62+
PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu"
63+
python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}"
64+
python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")'
65+
python -c 'import torchcodec; print(f"{torchcodec.__version__}"); print(f"{torchcodec.__file__}")'
66+
echo "::endgroup::"
67+
68+
echo "::group::Build and install TorchAudio"
69+
export BUILD_CPP_TEST=1
70+
python -m pip install . -v --no-build-isolation
71+
echo "::endgroup::"
72+
73+
echo "::group::Run TorchAudio C tests"
74+
(cd build/temp*/test/cpp && ./wall_collision)
75+
echo "::endgroup::"
76+
77+
echo "::group::Run TorchAudio tests"
4378
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true
4479
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true
4580
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true
@@ -54,15 +89,10 @@ jobs:
5489
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true
5590
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true
5691
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true
57-
echo '::endgroup::'
58-
59-
set -euxo pipefail
60-
61-
echo '::group::Install PyTorch and Torchaudio'
62-
./.github/scripts/unittest-linux/install.sh
63-
echo '::endgroup::'
92+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CTC_DECODER=true
93+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_unidecode=true
94+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true
95+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true
6496
65-
echo '::group::Run Tests'
66-
export PYTEST_K_EXTRA="and not librosa"
67-
./.github/scripts/unittest-linux/run_test.sh
68-
echo '::endgroup::'
97+
pytest test/torchaudio_unittest -k "not torchscript and not fairseq and not demucs and not librosa" -x
98+
echo "::endgroup::"

0 commit comments

Comments
 (0)