[TTS] Fix off-by-1 bug in Beta Binomial Prior #4616
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Fix a bug in the prior calculation used in the TTS aligner
Collection: [TTS]
Changelog
Before your PR is "Ready for review"
Pre checks:
PR Type:
Additional Information
The prior here is supposed to help the TTS model align by teaching it to place more weight on phonemes along the diagonal, with it always starting on the first phoneme and ending on the last phoneme.
The current logic produces a prior that looks like this, which awkwardly ends earlier than expected with maximum weight on the last phoneme before the end of the sequence:
After this change, the prior looks like this:
I think the intuition is that we model the attention as a binomial distribution (eg. coin flips with head being success, tail failure) where each success results in the attention moving on to the next phoneme. To reach the end of a sequence of N phonemes, you only need (N - 1) successes.