Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove global audio backend from test #3691

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/common_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .autograd_utils import use_deterministic_algorithms
from .backend_utils import set_audio_backend
from .case_utils import (
disabledInCI,
HttpServerMixin,
Expand Down Expand Up @@ -37,7 +36,6 @@
"get_whitenoise",
"get_sinusoid",
"get_spectrogram",
"set_audio_backend",
"TempDirMixin",
"HttpServerMixin",
"TestBaseMixin",
Expand Down
21 changes: 0 additions & 21 deletions test/torchaudio_unittest/common_utils/backend_utils.py

This file was deleted.

6 changes: 1 addition & 5 deletions test/torchaudio_unittest/common_utils/case_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
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"""
Expand Down Expand Up @@ -88,15 +86,13 @@ def get_url(self, *route):


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
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/cmuarctic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def get_mock_dataset(root_dir):


class TestCMUARCTIC(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
samples = []
Expand Down
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/datasets/commonvoice_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def _test_commonvoice(self, dataset):


class TestCommonVoiceEN(BaseTestCommonVoice, TorchaudioTestCase):
backend = "default"
root_dir = None

@classmethod
Expand All @@ -160,7 +159,6 @@ def test_commonvoice_path(self):


class TestCommonVoiceFR(BaseTestCommonVoice, TorchaudioTestCase):
backend = "default"
root_dir = None

@classmethod
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/dr_vctk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def get_mock_dataset(root_dir):


class TestDRVCTK(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
samples = {}
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/fluentcommands_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/gtzan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def get_mock_dataset(root_dir):


class TestGTZAN(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
samples = []
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/iemocap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def get_mock_dataset(dataset_dir: str):

class TestIemocap(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"

all_samples = []
script_samples = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def get_mock_datasets(root_dir):


class TestLibriLightLimited(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
samples_10min = []
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/librimix_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def get_mock_dataset(root_dir):


class LibriSpeechTestMixin(TempDirMixin):
backend = "default"

root_dir = None
samples = []
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/libritts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def get_mock_dataset(root_dir):


class TestLibriTTS(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
data = []
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/ljspeech_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def get_mock_dataset(root_dir):


class TestLJSpeech(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
data, _transcripts, _normalized_transcript = [], [], []
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/musdb_hq_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/quesst14_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def get_mock_dataset(dataset_dir):

class TestQuesst14(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"

utterances = {}
dev_samples = {}
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/snips_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def get_mock_datasets(dataset_dir):

class TestSnips(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"

train_samples = {}
valid_samples = {}
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/speechcommands_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def get_mock_dataset(dataset_dir):


class TestSpeechCommands(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
samples = []
Expand Down
16 changes: 2 additions & 14 deletions test/torchaudio_unittest/datasets/tedlium_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
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 = [
Expand Down Expand Up @@ -84,7 +83,7 @@ def get_mock_dataset(dataset_dir):
return mocked_samples


class Tedlium(TempDirMixin):
class Tedlium(TempDirMixin, TorchaudioTestCase):
root_dir = None
samples = {}

Expand Down Expand Up @@ -131,14 +130,3 @@ def test_tedlium_release3(self):
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"
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/vctk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def get_mock_dataset(root_dir):


class TestVCTK(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
samples = []
Expand Down
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/datasets/voxceleb1_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def get_mock_veri_dataset(root_dir: str, meta_file: str):

class TestVoxCeleb1Identification(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"

meta_file = "iden_list.txt"
train_samples = {}
Expand Down Expand Up @@ -166,7 +165,6 @@ def testVoxCeleb1SubsetTest(self):

class TestVoxCeleb1Verification(TempDirMixin, TorchaudioTestCase):
root_dir = None
backend = "default"

meta_file = "veri_test.txt"
train_samples = {}
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/datasets/yesno_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def get_mock_data(root_dir, labels):


class TestYesNo(TempDirMixin, TorchaudioTestCase):
backend = "default"

root_dir = None
data = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def _mock_dataset(root_dir, num_speaker):


class TestWSJ0Mix2(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
expected = None

Expand All @@ -78,7 +77,6 @@ def test_wsj0mix(self):


class TestWSJ0Mix3(TempDirMixin, TorchaudioTestCase):
backend = "default"
root_dir = None
expected = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ def _name_from_args(func, _, params):
class TestFunctional(common_utils.TorchaudioTestCase):
"""Test functions defined in `functional` module"""

backend = "default"

def assert_batch_consistency(self, functional, inputs, atol=1e-6, rtol=1e-5, seed=42):
n = inputs[0].size(0)
for i in range(1, len(inputs)):
Expand Down
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/functional/functional_cpu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class TestFunctionalFloat64(Functional, PytorchTestCase):

@skipIfNoSox
class TestApplyCodec(TorchaudioTestCase):
backend = "sox_io"

def _smoke_test(self, format, compression, check_num_frames):
"""
The purpose of this test suite is to verify that apply_codec functionalities do not exhibit
Expand Down
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/sox_effect/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ def speed(path):

@skipIfNoSox
class TestProcessPoolExecutor(TempDirMixin, PytorchTestCase):
backend = "sox_io"

def setUp(self):
sample_rate = 16000
self.flist = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
class TestTransforms(common_utils.TorchaudioTestCase):
"""Test suite for classes defined in `transforms` module"""

backend = "default"

def assert_batch_consistency(self, transform, batch, *args, atol=1e-8, rtol=1e-5, seed=42, **kwargs):
n = batch.size(0)

Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/transforms/transforms_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Tester(common_utils.TorchaudioTestCase):
backend = "default"

# create a sinewave signal for testing
sample_rate = 16000
Expand Down