Unverified Commit 512c2fa4 authored by Krishna Kalyan's avatar Krishna Kalyan Committed by GitHub
Browse files

Remove skipIfNoSoxBackend (#1390)


Co-authored-by: default avatarkrishnakalyan3 <skalyan@cloudera.com>
parent 14dd917e
...@@ -17,7 +17,6 @@ from .case_utils import ( ...@@ -17,7 +17,6 @@ from .case_utils import (
skipIfNoModule, skipIfNoModule,
skipIfNoKaldi, skipIfNoKaldi,
skipIfNoSox, skipIfNoSox,
skipIfNoSoxBackend,
) )
from .wav_utils import ( from .wav_utils import (
get_wav_data, get_wav_data,
......
...@@ -7,7 +7,6 @@ import unittest ...@@ -7,7 +7,6 @@ import unittest
import torch import torch
from torch.testing._internal.common_utils import TestCase as PytorchTestCase from torch.testing._internal.common_utils import TestCase as PytorchTestCase
import torchaudio
from torchaudio._internal.module_utils import ( from torchaudio._internal.module_utils import (
is_module_available, is_module_available,
is_sox_available, is_sox_available,
...@@ -96,8 +95,6 @@ def skipIfNoModule(module, display_name=None): ...@@ -96,8 +95,6 @@ def skipIfNoModule(module, display_name=None):
return unittest.skipIf(not is_module_available(module), f'"{display_name}" is not available') return unittest.skipIf(not is_module_available(module), f'"{display_name}" is not available')
skipIfNoSoxBackend = unittest.skipIf(
'sox' not in torchaudio.list_audio_backends(), 'Sox backend not available')
skipIfNoCuda = unittest.skipIf(not torch.cuda.is_available(), reason='CUDA not available') skipIfNoCuda = unittest.skipIf(not torch.cuda.is_available(), reason='CUDA not available')
skipIfNoSox = unittest.skipIf(not is_sox_available(), reason='Sox not available') skipIfNoSox = unittest.skipIf(not is_sox_available(), reason='Sox not available')
skipIfNoKaldi = unittest.skipIf(not is_kaldi_available(), reason='Kaldi not available') skipIfNoKaldi = unittest.skipIf(not is_kaldi_available(), reason='Kaldi not available')
...@@ -47,7 +47,6 @@ def extract_window(window, wave, f, frame_length, frame_shift, snip_edges): ...@@ -47,7 +47,6 @@ def extract_window(window, wave, f, frame_length, frame_shift, snip_edges):
@common_utils.skipIfNoSox @common_utils.skipIfNoSox
class Test_Kaldi(common_utils.TempDirMixin, common_utils.TorchaudioTestCase): class Test_Kaldi(common_utils.TempDirMixin, common_utils.TorchaudioTestCase):
backend = 'sox_io'
kaldi_output_dir = common_utils.get_asset_path('kaldi') kaldi_output_dir = common_utils.get_asset_path('kaldi')
test_filepath = common_utils.get_asset_path('kaldi_file.wav') test_filepath = common_utils.get_asset_path('kaldi_file.wav')
...@@ -113,7 +112,7 @@ class Test_Kaldi(common_utils.TempDirMixin, common_utils.TorchaudioTestCase): ...@@ -113,7 +112,7 @@ class Test_Kaldi(common_utils.TempDirMixin, common_utils.TorchaudioTestCase):
# clear the last 16 bits because they aren't used anyways # clear the last 16 bits because they aren't used anyways
y = ((y >> 16) << 16).float() y = ((y >> 16) << 16).float()
torchaudio.save(self.test_filepath, y, sr) torchaudio.save(self.test_filepath, y, sr)
sound, sample_rate = torchaudio.load(self.test_filepath, normalization=False) sound, sample_rate = common_utils.load_wav(self.test_filepath, normalize=False)
print(y >> 16) print(y >> 16)
self.assertTrue(sample_rate == sr) self.assertTrue(sample_rate == sr)
self.assertEqual(y, sound) self.assertEqual(y, sound)
......
...@@ -2,7 +2,7 @@ import torch ...@@ -2,7 +2,7 @@ import torch
import torchaudio.functional as F import torchaudio.functional as F
from torchaudio_unittest.common_utils import ( from torchaudio_unittest.common_utils import (
skipIfNoSoxBackend, skipIfNoSox,
skipIfNoExec, skipIfNoExec,
TempDirMixin, TempDirMixin,
TorchaudioTestCase, TorchaudioTestCase,
...@@ -14,7 +14,7 @@ from torchaudio_unittest.common_utils import ( ...@@ -14,7 +14,7 @@ from torchaudio_unittest.common_utils import (
) )
@skipIfNoSoxBackend @skipIfNoSox
@skipIfNoExec('sox') @skipIfNoExec('sox')
class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase): class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
def run_sox_effect(self, input_file, effect): def run_sox_effect(self, input_file, effect):
......
...@@ -2,17 +2,19 @@ import torchaudio.transforms as T ...@@ -2,17 +2,19 @@ import torchaudio.transforms as T
from parameterized import parameterized from parameterized import parameterized
from torchaudio_unittest.common_utils import ( from torchaudio_unittest.common_utils import (
skipIfNoSoxBackend, skipIfNoSox,
skipIfNoExec, skipIfNoExec,
TempDirMixin, TempDirMixin,
TorchaudioTestCase, TorchaudioTestCase,
get_asset_path, get_asset_path,
sox_utils, sox_utils,
load_wav, load_wav,
save_wav,
get_whitenoise,
) )
@skipIfNoSoxBackend @skipIfNoSox
@skipIfNoExec('sox') @skipIfNoExec('sox')
class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase): class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
def run_sox_effect(self, input_file, effect): def run_sox_effect(self, input_file, effect):
...@@ -24,6 +26,14 @@ class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase): ...@@ -24,6 +26,14 @@ class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
expected, _ = self.run_sox_effect(input_path, effects) expected, _ = self.run_sox_effect(input_path, effects)
self.assertEqual(result, expected, atol=atol, rtol=rtol) self.assertEqual(result, expected, atol=atol, rtol=rtol)
def get_whitenoise(self, sample_rate=8000):
noise = get_whitenoise(
sample_rate=sample_rate, duration=3, scale_factor=0.9,
)
path = self.get_temp_path("whitenoise.wav")
save_wav(path, noise, sample_rate)
return noise, path
@parameterized.expand([ @parameterized.expand([
('q', 'quarter_sine'), ('q', 'quarter_sine'),
('h', 'half_sine'), ('h', 'half_sine'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment