Skip to content

Commit

Permalink
fix(bin.synthesize): more informative error for wrong --language argu…
Browse files Browse the repository at this point in the history
…ment (#3294)

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
  • Loading branch information
eginhard authored Nov 24, 2023
1 parent 64f391b commit 4a2684b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions TTS/bin/synthesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4a2684b

Please sign in to comment.