Skip to content

Commit 8f58d14

Browse files
committed
Fixed tests on mac in CI by changing to use lighter model
1 parent 5c71eea commit 8f58d14

File tree

3 files changed

+15
-36
lines changed

3 files changed

+15
-36
lines changed

.github/workflows/run-tests.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ jobs:
5959

6060
- name: Run unit tests with coverage
6161
run: |
62-
export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
6362
poetry run pytest tests/unit --cov=./ --cov-report=xml
64-
env:
65-
PYTORCH_ENABLE_MPS_FALLBACK: 1
6663
6764
- name: Upload coverage reports to Codecov
6865
uses: codecov/codecov-action@v3

audio_separator/utils/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def main():
4242
download_model_only_help = "Download a single model file only, without performing separation."
4343

4444
io_params = parser.add_argument_group("Separation I/O Params")
45-
io_params.add_argument("-m", "--model_filename", default="model_bs_roformer_ep_317_sdr_12.9755.yaml", help=model_filename_help)
45+
io_params.add_argument("-m", "--model_filename", default="model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt", help=model_filename_help)
4646
io_params.add_argument("--output_format", default="FLAC", help=output_format_help)
4747
io_params.add_argument("--output_bitrate", default=None, help=output_bitrate_help)
4848
io_params.add_argument("--output_dir", default=None, help=output_dir_help)

tests/unit/test_cli.py

+14-32
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,10 @@ def common_expected_args():
2020
"output_single_stem": None,
2121
"invert_using_spec": False,
2222
"sample_rate": 44100,
23-
"mdx_params": {
24-
"hop_length": 1024,
25-
"segment_size": 256,
26-
"overlap": 0.25,
27-
"batch_size": 1,
28-
"enable_denoise": False,
29-
},
30-
"vr_params": {
31-
"batch_size": 4,
32-
"window_size": 512,
33-
"aggression": 5,
34-
"enable_tta": False,
35-
"enable_post_process": False,
36-
"post_process_threshold": 0.2,
37-
"high_end_process": False,
38-
},
39-
"demucs_params": {
40-
"segment_size": "Default",
41-
"shifts": 2,
42-
"overlap": 0.25,
43-
"segments_enabled": True,
44-
},
45-
"mdxc_params": {
46-
"segment_size": 256,
47-
"batch_size": 1,
48-
"overlap": 8,
49-
"override_model_segment_size": False,
50-
"pitch_shift": 0,
51-
},
23+
"mdx_params": {"hop_length": 1024, "segment_size": 256, "overlap": 0.25, "batch_size": 1, "enable_denoise": False},
24+
"vr_params": {"batch_size": 4, "window_size": 512, "aggression": 5, "enable_tta": False, "enable_post_process": False, "post_process_threshold": 0.2, "high_end_process": False},
25+
"demucs_params": {"segment_size": "Default", "shifts": 2, "overlap": 0.25, "segments_enabled": True},
26+
"mdxc_params": {"segment_size": 256, "batch_size": 1, "overlap": 8, "override_model_segment_size": False, "pitch_shift": 0},
5227
}
5328

5429

@@ -86,14 +61,21 @@ def test_cli_multiple_filenames(capsys):
8661

8762

8863
# Test the CLI with a specific audio file
89-
def test_cli_with_audio_file(capsys):
90-
test_args = ["cli.py", "test_audio.mp3"]
64+
def test_cli_with_audio_file(capsys, common_expected_args):
65+
test_args = ["cli.py", "test_audio.mp3", "--model_filename=UVR-MDX-NET-Inst_HQ_4.onnx"]
9166
with patch("audio_separator.separator.Separator.separate") as mock_separate:
9267
mock_separate.return_value = ["output_file.mp3"]
9368
with patch("sys.argv", test_args):
9469
# Call the main function in cli.py
9570
main()
96-
# Check if the separate
71+
72+
# Update expected args for this specific test
73+
common_expected_args["model_file_dir"] = "/tmp/audio-separator-models/"
74+
75+
# Check if the separate method was called with the correct arguments
76+
mock_separate.assert_called_once()
77+
78+
# Assertions
9779
assert mock_separate.called
9880

9981

0 commit comments

Comments
 (0)