Skip to content

Commit 3d65313

Browse files
Disable tests for deprecated functionality (#3942)
1 parent cb90cea commit 3d65313

File tree

10 files changed

+16
-11
lines changed

10 files changed

+16
-11
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,10 @@ if [[ "$(python --version)" = *3.9* || "$(python --version)" = *3.10* ]]; then
9292
# See https://github.com/librosa/librosa/issues/1270#issuecomment-759065048
9393
NUMBA_DEV_CHANNEL="-c numba/label/dev"
9494
fi
95-
# Note: installing librosa via pip fail because it will try to compile numba.
9695
(
9796
set -x
98-
conda install -y -c conda-forge ${NUMBA_DEV_CHANNEL} sox libvorbis librosa parameterized 'requests>=2.20' 'ffmpeg>=6,<7'
99-
pip install kaldi-io 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
97+
conda install -y -c conda-forge ${NUMBA_DEV_CHANNEL} sox libvorbis parameterized 'requests>=2.20' 'ffmpeg>=6,<7'
98+
pip install kaldi-io SoundFile librosa 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
10099

101100
# TODO: might be better to fix the single call to `pip install` above
102101
pip install "pillow<10.0" "scipy<1.10" "numpy<2.0"

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,5 @@ fi
3030

3131
(
3232
cd test
33-
pytest "${args[@]}" torchaudio_unittest
34-
coverage html
33+
pytest torchaudio_unittest -k "not backend and not /io/ and not prototype and not sox and not ffmpeg and not fairseq and not hdemucs"
3534
)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true
5757
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true
5858
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true
59+
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true
5960
echo '::endgroup::'
6061
6162
set -euxo pipefail

examples/asr/emformer_rnnt/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def forward(self, input):
9595
class WarmupLR(torch.optim.lr_scheduler._LRScheduler):
9696
def __init__(self, optimizer, warmup_updates, last_epoch=-1, verbose=False):
9797
self.warmup_updates = warmup_updates
98-
super().__init__(optimizer, last_epoch=last_epoch, verbose=verbose)
98+
super().__init__(optimizer, last_epoch=last_epoch)
9999

100100
def get_lr(self):
101101
return [(min(1.0, self._step_count / self.warmup_updates)) * base_lr for base_lr in self.base_lrs]

src/torchaudio/_backend/sox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def load(
4141
"Please use an alternative backend that does support loading from file-like objects, e.g. FFmpeg.",
4242
)
4343
else:
44-
ret = sox_ext.load_audio_file(uri, frame_offset, num_frames, normalize, channels_first, format)
44+
ret = sox_ext.load_audio_file(str(uri), frame_offset, num_frames, normalize, channels_first, format)
4545
if not ret:
4646
raise RuntimeError(f"Failed to load audio from {uri}.")
4747
return ret
@@ -70,7 +70,7 @@ def save(
7070
)
7171
else:
7272
sox_ext.save_audio_file(
73-
uri,
73+
str(uri),
7474
src,
7575
sample_rate,
7676
channels_first,

src/torchaudio/functional/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
)
6969

7070
rnnt_loss = dropping_support(_rnnt_loss)
71-
7271
__all__ = [
7372
"amplitude_to_DB",
7473
"compute_deltas",

src/torchaudio/transforms/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from torchaudio._internal.module_utils import dropping_support
12
from ._multi_channel import MVDR, PSD, RTFMVDR, SoudenMVDR
23
from ._transforms import (
34
AddNoise,
@@ -34,6 +35,7 @@
3435
Vol,
3536
)
3637

38+
RNNTLoss.__init__ = dropping_support(RNNTLoss.__init__)
3739

3840
__all__ = [
3941
"AddNoise",

src/torchaudio/transforms/_transforms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from torch.nn.parameter import UninitializedParameter
1111

1212
from torchaudio import functional as F
13+
from torchaudio.functional.functional import rnnt_loss
1314
from torchaudio.functional.functional import (
1415
_apply_sinc_resample_kernel,
1516
_check_convolve_mode,
@@ -1846,7 +1847,7 @@ def forward(
18461847
Tensor: Loss with the reduction option applied. If ``reduction`` is ``"none"``, then size (batch),
18471848
otherwise scalar.
18481849
"""
1849-
return F.rnnt_loss(
1850+
return rnnt_loss(
18501851
logits,
18511852
targets,
18521853
logit_lengths,

test/torchaudio_unittest/functional/functional_cpu_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import torch
44
import torchaudio.functional as F
55
from parameterized import parameterized
6+
import unittest
67
from torchaudio_unittest.common_utils import PytorchTestCase, skipIfNoSox, TorchaudioTestCase
78

89
from .functional_impl import Functional, FunctionalCPUOnly
@@ -22,6 +23,7 @@ class TestFunctionalFloat64(Functional, PytorchTestCase):
2223
device = torch.device("cpu")
2324

2425

26+
@unittest.skip("deprecated")
2527
@skipIfNoSox
2628
class TestApplyCodec(TorchaudioTestCase):
2729
def _smoke_test(self, format, compression, check_num_frames):

test/torchaudio_unittest/functional/torchscript_consistency_impl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from parameterized import parameterized
77
from torchaudio_unittest import common_utils
88
from torchaudio_unittest.common_utils import skipIfRocm, TempDirMixin, TestBaseMixin, torch_script
9+
from torchaudio.functional.functional import rnnt_loss
10+
911

1012

1113
class Functional(TempDirMixin, TestBaseMixin):
@@ -801,7 +803,7 @@ def func(tensor):
801803
targets = torch.tensor([[1, 2]], device=tensor.device, dtype=torch.int32)
802804
logit_lengths = torch.tensor([2], device=tensor.device, dtype=torch.int32)
803805
target_lengths = torch.tensor([2], device=tensor.device, dtype=torch.int32)
804-
return F.rnnt_loss(tensor, targets, logit_lengths, target_lengths)
806+
return rnnt_loss(tensor, targets, logit_lengths, target_lengths)
805807

806808
logits = torch.tensor(
807809
[

0 commit comments

Comments
 (0)