Skip to content

Commit 6404fed

Browse files
fix: report ASR model type instead of name in unknown type error
Signed-off-by: Andrew White <andrewh@cdw.com>
1 parent 58e74a2 commit 6404fed

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

nemo/collections/tts/modules/magpietts_inference/evaluate_generated_audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def load_evaluation_models(
256256
elif asr_model_type == "whisper":
257257
models['asr_model'] = WhisperTranscriber(model_name=asr_model_name, device=device)
258258
else:
259-
raise ValueError(f"Unknown ASR model type {asr_model_name}")
259+
raise ValueError(f"Unknown ASR model type {asr_model_type}")
260260

261261
if sv_model_type == "wavlm":
262262
models['feature_extractor'] = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/wavlm-base-plus-sv')
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
Tests for MagpieTTS generated audio evaluation utilities.
17+
"""
18+
19+
import pytest
20+
21+
from nemo.collections.tts.modules.magpietts_inference.evaluate_generated_audio import load_evaluation_models
22+
23+
24+
class TestLoadEvaluationModels:
25+
"""Tests for load_evaluation_models."""
26+
27+
def test_unknown_asr_model_type_error_includes_type(self):
28+
"""Unknown asr_model_type should be reported in the error message, not the model name."""
29+
with pytest.raises(ValueError, match="Unknown ASR model type invalid_type"):
30+
load_evaluation_models(asr_model_type="invalid_type", asr_model_name="some_model_name")

0 commit comments

Comments
 (0)