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

[tests] Make tests faster #496

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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: 1 addition & 1 deletion asteroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .utils import deprecation_utils, torch_utils # noqa

project_root = str(pathlib.Path(__file__).expanduser().absolute().parent.parent)
__version__ = "0.5.1rc0"
__version__ = "0.5.1"


def show_available_models():
Expand Down
4 changes: 2 additions & 2 deletions tests/dsp/beamforming_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
def _default_beamformer_test(beamformer: Beamformer, batch_size=2, n_mics=4, **forward_kwargs):
scm = SCM()

speech = torch.randn(batch_size, n_mics, 16000 * 6)
noise = torch.randn(batch_size, n_mics, 16000 * 6)
speech = torch.randn(batch_size, n_mics, 16000 * 2)
noise = torch.randn(batch_size, n_mics, 16000 * 2)
mix = speech + noise
# GeV Beamforming
mix_stft = stft(mix)
Expand Down
4 changes: 2 additions & 2 deletions tests/losses/mixit_wrapper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def test_mixitwrapper_as_pit_wrapper(batch_size, n_src, time):
assert reordered_est.shape == est_targets.shape


@pytest.mark.parametrize("batch_size", [1, 2, 4])
@pytest.mark.parametrize("batch_size", [1, 2])
@pytest.mark.parametrize("factor", [1, 2, 3])
@pytest.mark.parametrize("n_mix", [2, 3])
@pytest.mark.parametrize("time", [16000])
@pytest.mark.parametrize("time", [2000])
def test_mixit_wrapper(batch_size, factor, n_mix, time):
mixtures = torch.randn(batch_size, n_mix, time)
n_src = n_mix * factor
Expand Down
6 changes: 4 additions & 2 deletions tests/models/fasnet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from asteroid.models.fasnet import FasNetTAC


@pytest.mark.parametrize("samples", [8372])
@pytest.mark.parametrize("samples", [4372])
@pytest.mark.parametrize("batch_size", [1, 2])
@pytest.mark.parametrize("n_mics", [1, 2])
@pytest.mark.parametrize("n_src", [1, 2, 3])
@pytest.mark.parametrize("n_src", [2, 3])
@pytest.mark.parametrize("use_tac", [True, False])
@pytest.mark.parametrize("enc_dim", [4])
@pytest.mark.parametrize("feature_dim", [8])
Expand All @@ -23,5 +23,7 @@ def test_fasnet(batch_size, n_mics, samples, n_src, use_tac, enc_dim, feature_di
feature_dim=feature_dim,
window_ms=window,
context_ms=context,
hidden_dim=16,
tac_hidden_dim=12,
)
fasnet(mixture, valid_mics)
14 changes: 8 additions & 6 deletions tests/models/xumx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

sources = [
["bass", "drums", "vocals", "other"],
["vocals", "drums", "bass"],
["vocals", "other"],
["drums"],
]

Expand All @@ -19,8 +17,8 @@
@pytest.mark.parametrize(
"data",
(
torch.rand(3, 2, 44100, requires_grad=False),
torch.rand(1, 2, 2 * 44100, requires_grad=False),
torch.rand(3, 2, 4100, requires_grad=False),
torch.rand(1, 2, 2 * 4100, requires_grad=False),
),
)
def test_forward(nb_channels, sources, bidirectional, spec_power, return_time_signals, data):
Expand All @@ -29,7 +27,7 @@ def test_forward(nb_channels, sources, bidirectional, spec_power, return_time_si
input_mean=None,
input_scale=None,
nb_channels=nb_channels,
hidden_size=128,
hidden_size=10,
nb_layers=2,
in_chan=4096,
n_hop=1024,
Expand Down Expand Up @@ -69,7 +67,11 @@ def test_get_model_args():

def test_model_loading():
sources_tmp = ["bass", "drums", "vocals", "other"]
model = XUMX(sources=sources_tmp)
model = XUMX(
sources=sources_tmp,
nb_layers=2,
hidden_size=12,
)

model_conf = model.serialize()

Expand Down