-
Notifications
You must be signed in to change notification settings - Fork 27.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Whisper shortform EOS #33917
Fix Whisper shortform EOS #33917
Conversation
if is_shortform and generation_config.pad_token_id == generation_config.eos_token_id: | ||
num_paddings -= 1 | ||
|
||
if num_paddings != 0: | ||
seek_sequence = seek_sequence[:-num_paddings] | ||
if return_token_timestamps and not is_shortform: | ||
seek_outputs[i]["token_timestamps"] = seek_outputs[i]["token_timestamps"][:-num_paddings] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure if this fix covers all use-cases, @eustlb, would you mind do a sanity check ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not merge before being sure
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Closing as it was fixed in #34135 ! 🤗 |
What does this PR do?
Since short and longform merging, Whisper removed EOS tokens when doing shortform transcription, which is something not happening in the original implementation. It fixes the
test_default_multilingual_transcription_short_form
andtest_generate_with_prompt_ids
testsA side effect is that average logprob was miscomputed.
cc @eustlb