Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add guard against having both use_sid and use_spk_embed set to true#6208

Merged
sw005320 merged 4 commits intoespnet:masterfrom
ZhuoyanTao:fix/tts-template-disallow-sid-plus-spk-embed
Aug 15, 2025
Merged

Add guard against having both use_sid and use_spk_embed set to true#6208
sw005320 merged 4 commits intoespnet:masterfrom
ZhuoyanTao:fix/tts-template-disallow-sid-plus-spk-embed

Conversation

@ZhuoyanTao
Copy link
Contributor

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:

  • conflict -> exits with error
  • SID-only -> OK
  • spk-embed-only -> OK
  • both false -> OK

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. SID Speaker identification/embedding labels Aug 14, 2025
@mergify mergify bot added the ESPnet2 label Aug 14, 2025
@sw005320 sw005320 requested a review from Copilot August 14, 2025 15:24
@sw005320 sw005320 added this to the v.202509 milestone Aug 14, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_sid and --use_spk_embed are 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.

run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [[ ${use_sid:-false} == true && ${use_spk_embed:-false} == true ]]; then
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if [[ ${use_sid:-false} == true && ${use_spk_embed:-false} == true ]]; then
if [[ ${use_sid:-false} = true && ${use_spk_embed:-false} = true ]]; then

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have implemented this suggestion in the new commit.

@sw005320 sw005320 merged commit 7268bd4 into espnet:master Aug 15, 2025
31 checks passed
@sw005320
Copy link
Contributor

Thanks!

@Fhrozen Fhrozen mentioned this pull request Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ESPnet2 SID Speaker identification/embedding size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants