Unverified Commit a59e9ab8 authored by moto's avatar moto Committed by GitHub
Browse files

Remove global audio backend from test (#3691)

global audio backend is removed thus this is no-op.
parent 4c85f817
from .autograd_utils import use_deterministic_algorithms
from .backend_utils import set_audio_backend
from .case_utils import (
disabledInCI,
HttpServerMixin,
......@@ -37,7 +36,6 @@ __all__ = [
"get_whitenoise",
"get_sinusoid",
"get_spectrogram",
"set_audio_backend",
"TempDirMixin",
"HttpServerMixin",
"TestBaseMixin",
......
import unittest
import torchaudio
def set_audio_backend(backend):
"""Allow additional backend value, 'default'"""
backends = torchaudio.list_audio_backends()
if backend == "soundfile":
be = "soundfile"
elif backend == "default":
if "sox_io" in backends:
be = "sox_io"
elif "soundfile" in backends:
be = "soundfile"
else:
raise unittest.SkipTest("No default backend available")
else:
be = backend
torchaudio.set_audio_backend(be)
......@@ -15,8 +15,6 @@ from torch.testing._internal.common_utils import TestCase as PytorchTestCase
from torchaudio._internal.module_utils import eval_env, is_module_available
from torchaudio.utils.ffmpeg_utils import get_video_decoders, get_video_encoders
from .backend_utils import set_audio_backend
class TempDirMixin:
"""Mixin to provide easy access to temp dir"""
......@@ -88,15 +86,13 @@ class HttpServerMixin(TempDirMixin):
class TestBaseMixin:
"""Mixin to provide consistent way to define device/dtype/backend aware TestCase"""
"""Mixin to provide consistent way to define device/dtype aware TestCase"""
dtype = None
device = None
backend = None
def setUp(self):
super().setUp()
set_audio_backend(self.backend)
torch.random.manual_seed(2434)
@property
......
......@@ -47,7 +47,6 @@ def get_mock_dataset(root_dir):
class TestCMUARCTIC(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
samples = []
......
......@@ -142,7 +142,6 @@ class BaseTestCommonVoice(TempDirMixin):
class TestCommonVoiceEN(BaseTestCommonVoice, TorchaudioTestCase):
backend = "default"
root_dir = None
@classmethod
......@@ -160,7 +159,6 @@ class TestCommonVoiceEN(BaseTestCommonVoice, TorchaudioTestCase):
class TestCommonVoiceFR(BaseTestCommonVoice, TorchaudioTestCase):
backend = "default"
root_dir = None
@classmethod
......
......@@ -74,7 +74,6 @@ def get_mock_dataset(root_dir):
class TestDRVCTK(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
samples = {}
......
......@@ -104,7 +104,6 @@ def get_mock_dataset(dataset_dir: str):
class TestFluentSpeechCommands(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"
mocked_train_samples = []
mocked_valid_samples = []
......
......@@ -37,7 +37,6 @@ def get_mock_dataset(root_dir):
class TestGTZAN(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
samples = []
......
......@@ -91,7 +91,6 @@ def get_mock_dataset(dataset_dir: str):
class TestIemocap(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"
all_samples = []
script_samples = []
......
......@@ -69,7 +69,6 @@ def get_mock_datasets(root_dir):
class TestLibriLightLimited(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
samples_10min = []
......
......@@ -65,7 +65,6 @@ def get_mock_dataset(root_dir: str, num_speaker: int):
class TestLibriMix(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
samples_2spk = []
......
......@@ -49,7 +49,6 @@ def get_mock_dataset(root_dir):
class LibriSpeechTestMixin(TempDirMixin):
backend = "default"
root_dir = None
samples = []
......
......@@ -41,7 +41,6 @@ def get_mock_dataset(root_dir):
class TestLibriTTS(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
data = []
......
......@@ -45,7 +45,6 @@ def get_mock_dataset(root_dir):
class TestLJSpeech(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
data, _transcripts, _normalized_transcript = [], [], []
......
......@@ -86,7 +86,6 @@ def get_mock_dataset(dataset_dir):
class TestMusDB_HQ(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"
train_all_samples = {}
train_only_samples = {}
......
......@@ -104,7 +104,6 @@ def get_mock_dataset(dataset_dir):
class TestQuesst14(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"
utterances = {}
dev_samples = {}
......
......@@ -82,7 +82,6 @@ def get_mock_datasets(dataset_dir):
class TestSnips(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"
train_samples = {}
valid_samples = {}
......
......@@ -95,7 +95,6 @@ def get_mock_dataset(dataset_dir):
class TestSpeechCommands(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
samples = []
......
import os
import platform
from pathlib import Path
from torchaudio.datasets import tedlium
from torchaudio_unittest.common_utils import get_whitenoise, save_wav, skipIfNoSox, TempDirMixin, TorchaudioTestCase
from torchaudio_unittest.common_utils import get_whitenoise, save_wav, TempDirMixin, TorchaudioTestCase
# Used to generate a unique utterance for each dummy audio file
_UTTERANCES = [
......@@ -84,7 +83,7 @@ def get_mock_dataset(dataset_dir):
return mocked_samples
class Tedlium(TempDirMixin):
class Tedlium(TempDirMixin, TorchaudioTestCase):
root_dir = None
samples = {}
......@@ -131,14 +130,3 @@ class Tedlium(TempDirMixin):
release = "release3"
dataset = tedlium.TEDLIUM(self.root_dir, release=release)
self._test_tedlium(dataset, release)
class TestTedliumSoundfile(Tedlium, TorchaudioTestCase):
backend = "soundfile"
if platform.system() != "Windows":
@skipIfNoSox
class TestTedliumSoxIO(Tedlium, TorchaudioTestCase):
backend = "sox_io"
......@@ -57,7 +57,6 @@ def get_mock_dataset(root_dir):
class TestVCTK(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
samples = []
......
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