From 9b2dfe0995e7b3eef55ef929bbd7202f022dcf6b Mon Sep 17 00:00:00 2001 From: Enno Hermann Date: Thu, 23 Nov 2023 16:55:16 +0100 Subject: [PATCH] fix(bin.synthesize): more informative error for wrong --language argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In multilingual models, the target language is specified via the `--language_idx` argument. However, the `tts` CLI also accepts a `--language` argument for use with Coqui Studio, so it is easy to choose the wrong one, resulting in the following confusing error at synthesis time: ``` AssertionError: ❗ Language None is not supported. Supported languages are ['en', 'es', 'fr', 'de', 'it', 'pt', 'pl', 'tr', 'ru', 'nl', 'cs', 'ar', 'zh-cn', 'hu', 'ko', 'ja'] ``` This commit adds a better error message when `--language` is passed for a non-studio model. Fixes #3270, fixes #3291 --- TTS/bin/synthesize.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TTS/bin/synthesize.py b/TTS/bin/synthesize.py index ddfe35d29d..d9ec3063e6 100755 --- a/TTS/bin/synthesize.py +++ b/TTS/bin/synthesize.py @@ -419,6 +419,13 @@ def main(): print(" > Saving output to ", args.out_path) return + if args.language_idx is None and args.language is not None: + msg = ( + "--language is only supported for Coqui Studio models. " + "Use --language_idx to specify the target language for multilingual models." + ) + raise ValueError(msg) + # CASE4: load pre-trained model paths if args.model_name is not None and not args.model_path: model_path, config_path, model_item = manager.download_model(args.model_name)