Skip to content

Commit 03b441e

Browse files
committed
Merge branch 'main' into remove_backends
2 parents 34d39ed + 93f582c commit 03b441e

File tree

10 files changed

+41
-140
lines changed

10 files changed

+41
-140
lines changed

.github/scripts/unittest-linux/install.sh

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,7 @@ esac
2424
conda create -n ci -y python="${PYTHON_VERSION}"
2525
conda activate ci
2626

27-
# 1. Install PyTorch
28-
# if [ -z "${CUDA_VERSION:-}" ] ; then
29-
# if [ "${os}" == MacOSX ] ; then
30-
# cudatoolkit=''
31-
# else
32-
# cudatoolkit="cpuonly"
33-
# fi
34-
# version="cpu"
35-
# else
36-
# version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
37-
# export CUDATOOLKIT_CHANNEL="nvidia"
38-
# cudatoolkit="pytorch-cuda=${version}"
39-
# fi
40-
41-
# printf "Installing PyTorch with %s\n" "${cudatoolkit}"
42-
# (
43-
# if [ "${os}" == MacOSX ] ; then
44-
# # TODO: this can be removed as soon as linking issue could be resolved
45-
# # see https://github.com/pytorch/pytorch/issues/62424 from details
46-
# MKL_CONSTRAINT='mkl==2021.2.0'
47-
# pytorch_build=pytorch
48-
# else
49-
# MKL_CONSTRAINT=''
50-
# pytorch_build="pytorch[build="*${version}*"]"
51-
# fi
52-
# set -x
53-
54-
# if [[ -z "$cudatoolkit" ]]; then
55-
# conda install ${CONDA_CHANNEL_FLAGS:-} -y -c "pytorch-${UPLOAD_CHANNEL}" $MKL_CONSTRAINT "pytorch-${UPLOAD_CHANNEL}::${pytorch_build}"
56-
# else
57-
# conda install pytorch ${cudatoolkit} ${CONDA_CHANNEL_FLAGS:-} -y -c "pytorch-${UPLOAD_CHANNEL}" -c nvidia $MKL_CONSTRAINT
58-
# fi
59-
# )
60-
61-
export GPU_ARCH_TYPE="cpu" # TODO change this
27+
export GPU_ARCH_TYPE="cpu"
6228

6329
case $GPU_ARCH_TYPE in
6430
cpu)
@@ -89,22 +55,4 @@ printf "* Installing test tools\n"
8955
# On this CI, for whatever reason, we're only able to install ffmpeg 4.
9056
conda install -y "ffmpeg<5"
9157

92-
NUMBA_DEV_CHANNEL=""
93-
if [[ "$(python --version)" = *3.9* || "$(python --version)" = *3.10* ]]; then
94-
# Numba isn't available for Python 3.9 and 3.10 except on the numba dev channel and building from source fails
95-
# See https://github.com/librosa/librosa/issues/1270#issuecomment-759065048
96-
NUMBA_DEV_CHANNEL="-c numba/label/dev"
97-
fi
98-
(
99-
set -x
100-
conda install -y -c conda-forge ${NUMBA_DEV_CHANNEL} libvorbis parameterized 'requests>=2.20'
101-
pip install SoundFile coverage pytest pytest-cov scipy expecttest unidecode inflect Pillow sentencepiece pytorch-lightning 'protobuf<4.21.0' demucs tinytag pyroomacoustics flashlight-text git+https://github.com/kpu/kenlm
102-
103-
# TODO: might be better to fix the single call to `pip install` above
104-
pip install pillow scipy "numpy>=1.26"
105-
)
106-
# Install fairseq
107-
git clone https://github.com/pytorch/fairseq
108-
cd fairseq
109-
git checkout e47a4c8
110-
pip install .
58+
pip3 install parameterized requests coverage pytest pytest-cov scipy numpy expecttest

.github/scripts/unittest-linux/run_test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ fi
2929
)
3030

3131
(
32+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CTC_DECODER=true
33+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_unidecode=true
34+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true
35+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true
3236
cd test
33-
pytest torchaudio_unittest -k "not backend and not (sox and not compatibility) and not /io/ and not prototype and not ffmpeg and not fairseq and not hdemucs and not (torchscript and rnnt) and not torchscript_consistency"
37+
pytest torchaudio_unittest -k "not backend and not /io/ and not prototype and not ffmpeg and not fairseq and not hdemucs and not (torchscript and rnnt) and not torchscript_consistency"
3438
)

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

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true
4141
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true
4242
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true
43+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_demucs=true
4344
# Avoid reproducibility errors with CUBLAS: https://docs.nvidia.com/cuda/cublas/index.html#results-reproducibility
4445
export CUBLAS_WORKSPACE_CONFIG=:4096:8
4546
@@ -73,34 +74,8 @@ jobs:
7374
7475
echo "::endgroup::"
7576
echo "::group::Install other Dependencies"
76-
# conda install \
77-
# --quiet --yes \
78-
# -c conda-forge \
79-
# -c numba/label/dev \
80-
# libvorbis parameterized 'requests>=2.20'
81-
# pip3 install --progress-bar off \
82-
# SoundFile \
83-
# coverage \
84-
# pytest \
85-
# pytest-cov \
86-
# scipy \
87-
# transformers \
88-
# expecttest \
89-
# unidecode \
90-
# inflect \
91-
# Pillow \
92-
# sentencepiece \
93-
# pytorch-lightning \
94-
# 'protobuf<4.21.0' \
95-
# demucs \
96-
# tinytag \
97-
# flashlight-text \
98-
# git+https://github.com/kpu/kenlm/ \
99-
# git+https://github.com/pytorch/fairseq.git@e47a4c8
10077
101-
pip3 install parameterized requests
102-
pip3 install SoundFile coverage pytest pytest-cov scipy expecttest unidecode inflect Pillow sentencepiece pytorch-lightning 'protobuf<4.21.0' demucs tinytag
103-
pip3 install pillow scipy "numpy>=1.26"
78+
pip3 install parameterized requests coverage pytest pytest-cov scipy numpy expecttest
10479
10580
echo "::endgroup::"
10681
echo "::group::Run tests"

docs/requirements-tutorials.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
11
IPython
2-
deep-phonemizer
3-
boto3
4-
cython
5-
pandas
6-
librosa==0.10.0
7-
sentencepiece
8-
pandoc
9-
mir_eval
10-
pesq
11-
pystoi

examples/tutorials/audio_feature_extractions_tutorial.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
print(torch.__version__)
2626
print(torchaudio.__version__)
2727

28-
import librosa
2928
import matplotlib.pyplot as plt
3029

3130
######################################################################

test/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
import sys
22
from pathlib import Path
33

4+
# Note: [TorchCodec test dependency mocking hack]
5+
# We are adding the `test/` directory to the system path. This causes the
6+
# `tests/torchcodec` folder to be importable, and in particular, this makes it
7+
# possible to mock torchcodec utilities. E.g. executing:
8+
#
9+
# ```
10+
# from torchcodec.decoders import AudioDecoder
11+
# ```
12+
# directly or indirectly when running the tests will effectively be loading the
13+
# mocked `AudioDecoder` implemented in `test/torchcodec/decoders.py`, which
14+
# relies on scipy instead of relying on torchcodec.
15+
#
16+
# So whenever `torchaudio.load()` is called from within the tests, it's the
17+
# mocked scipy `AudioDecoder` that gets used. Ultimately, this allows us *not*
18+
# to add torchcodec as a test dependency of torchaudio: we can just rely on
19+
# scipy.
20+
#
21+
# This is VERY hacky and ideally we should implement a more robust way to mock
22+
# torchcodec.
423
sys.path.append(str(Path(__file__).parent.resolve()))

test/torchaudio_unittest/test_load_save_torchcodec.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
from torchaudio import load_with_torchcodec, save_with_torchcodec
1313
from torchaudio_unittest.common_utils import get_asset_path
1414

15-
# Now, load/save_torchcodec are the same as torchaudio.load/save, so
16-
# there is no need to test this.
15+
# These tests were ran when `torchaudio.load()` and `torchaudio.save()` were
16+
# still relying on their previous backends (ffmpeg, sox, soundfile). We needed
17+
# to validate that the newly introduced `load_with_torchcodec()` and
18+
# save_with_torchcodec() were matching their results.
19+
# From 2.9, `load()` and `save()` now internally rely on `load_with_torchcodec()` and
20+
# `save_with_torchcodec()` directly, so these tests are now redundant and we
21+
# skip them unconditionally.
1722
pytest.skip(allow_module_level=True)
1823

1924
def get_ffmpeg_version():

test/torchaudio_unittest/utils/sox_utils_test.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

test/torchcodec/decoders.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import torchaudio_unittest.common_utils.wav_utils as wav_utils
22
from types import SimpleNamespace
33

4+
# See corresponding [TorchCodec test dependency mocking hack] note in
5+
# conftest.py
6+
47
class AudioDecoder:
58
def __init__(self, uri):
69
self.uri = uri

test/torchcodec/encoders.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import torchaudio_unittest.common_utils.wav_utils as wav_utils
22
from types import SimpleNamespace
33

4+
# See corresponding [TorchCodec test dependency mocking hack] note in
5+
# conftest.py
6+
47
class AudioEncoder:
58
def __init__(self, data, sample_rate):
69
self.data = data

0 commit comments

Comments
 (0)