Skip to content

Commit caba63f

Browse files
samanklesariapearu
andauthored
Revise Linux CPU unittests CI workflow (#4098)
Co-authored-by: Pearu Peterson <[email protected]>
1 parent f0a4999 commit caba63f

File tree

1 file changed

+50
-21
lines changed

1 file changed

+50
-21
lines changed

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

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
tests:
1414
strategy:
1515
matrix:
16-
# TODO all from 3.9 to 3.13
17-
python_version: ["3.11"]
16+
python-version: ["3.11"]
17+
ffmpeg-version: ["7"]
1818
fail-fast: false
1919
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
2020
permissions:
@@ -23,26 +23,64 @@ jobs:
2323
with:
2424
runner: linux.12xlarge
2525
repository: pytorch/audio
26+
gpu-arch-type: cpu
27+
gpu-arch-version:
2628
timeout: 120
27-
script: |
28-
echo '::group::Setup Environment Variables'
29-
# Mark Build Directory Safe
30-
git config --global --add safe.directory /__w/audio/audio
29+
job-name: linux-cpu
3130

31+
script: |
32+
set -ex
3233
# Set up Environment Variables
33-
export PYTHON_VERSION="${{ matrix.python_version }}"
34+
export PYTHON_VERSION="${{ matrix.python-version }}"
35+
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
3436
export PIP_PROGRESS_BAR=off
3537
export CONDA_QUIET=1
36-
export CUDA_TESTS_ONLY="0"
37-
unset CUDA_VERSION
3838
39-
# Set CHANNEL
39+
# Set UPLOAD_CHANNEL
4040
if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
4141
export UPLOAD_CHANNEL=test
4242
else
4343
export UPLOAD_CHANNEL=nightly
4444
fi
4545
46+
echo "::group::Create conda env"
47+
# Mark Build Directory Safe
48+
git config --global --add safe.directory /__w/audio/audio
49+
conda create -c conda-forge --strict-channel-priority -y -n ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja
50+
conda activate ci_env
51+
conda info
52+
ffmpeg -version
53+
python -m pip install --upgrade pip
54+
# We add conda library path as otherwise torchcodec is not
55+
# able to load ffmpeg shared libraries:
56+
export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
57+
echo "::endgroup::"
58+
59+
echo "::group::Install TorchAudio test and PyTorch dependencies"
60+
python -m pip install parameterized requests coverage pytest pytest-cov scipy numpy expecttest
61+
echo "::endgroup::"
62+
63+
echo "::group::Install PyTorch and TorchCodec"
64+
PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu"
65+
python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}"
66+
python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}")'
67+
python -c 'import torchcodec; print(f"{torchcodec.__version__}"); print(f"{torchcodec.__file__}")'
68+
echo "::endgroup::"
69+
70+
echo "::group::Build and install TorchAudio"
71+
export BUILD_CPP_TEST=1
72+
python -m pip install . -v --no-build-isolation
73+
echo "::endgroup::"
74+
75+
echo "::group::Run TorchAudio C tests"
76+
(cd build/temp*/test/cpp && ./wall_collision)
77+
echo "::endgroup::"
78+
79+
echo "::group::Run TorchAudio tests"
80+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CTC_DECODER=true
81+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_unidecode=true
82+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true
83+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true
4684
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true
4785
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true
4886
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true
@@ -58,14 +96,5 @@ jobs:
5896
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true
5997
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true
6098
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true
61-
echo '::endgroup::'
62-
63-
set -euxo pipefail
64-
65-
echo '::group::Install PyTorch and Torchaudio'
66-
./.github/scripts/unittest-linux/install.sh
67-
echo '::endgroup::'
68-
69-
echo '::group::Run Tests'
70-
./.github/scripts/unittest-linux/run_test.sh
71-
echo '::endgroup::'
99+
pytest test/torchaudio_unittest -k "not torchscript and not fairseq and not demucs" -x
100+
echo "::endgroup::"

0 commit comments

Comments
 (0)