Add guard against having both use_sid and use_spk_embed set to true#6208
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds a validation guard to prevent users from enabling both speaker IDs and speaker embeddings simultaneously in the TTS template script, as these modes are mutually exclusive and cause confusing behavior.
- Adds parameter validation after option parsing
- Exits with error code 2 when both
--use_sidand--use_spk_embedare set to true - Provides clear error message explaining the mutual exclusivity
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
egs2/TEMPLATE/tts1/tts.sh
Outdated
| run_args=$(scripts/utils/print_args.sh $0 "$@") | ||
| . utils/parse_options.sh | ||
|
|
||
| if [[ ${use_sid:-false} == true && ${use_spk_embed:-false} == true ]]; then |
There was a problem hiding this comment.
The condition uses string comparison ('== true') which is less robust than boolean evaluation. Consider using '[[ ${use_sid:-false} = true && ${use_spk_embed:-false} = true ]]' with single equals for POSIX compliance, or restructure to use proper boolean logic if these variables are expected to be boolean.
| if [[ ${use_sid:-false} == true && ${use_spk_embed:-false} == true ]]; then | |
| if [[ ${use_sid:-false} = true && ${use_spk_embed:-false} = true ]]; then |
There was a problem hiding this comment.
I have implemented this suggestion in the new commit.
|
Thanks! |
What did you change?
This adds a guard to the TEMPLATE tts.sh so users can’t enable both
speaker IDs and speaker embeddings at the same time.
Why did you make this change?
These modes are mutually exclusive in recipes and lead to
confusing behavior if both are enabled.
Is your PR small enough?
yes
Additional Context
Tested with: