Skip to content
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

Closed

Conversation

ylacombe
Copy link
Contributor

@ylacombe ylacombe commented Oct 3, 2024

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 and test_generate_with_prompt_ids tests

A side effect is that average logprob was miscomputed.

cc @eustlb

Comment on lines +894 to +900
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]
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'm actually not sure if this fix covers all use-cases, @eustlb, would you mind do a sanity check ?

Copy link
Contributor Author

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

@HuggingFaceDocBuilderDev

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.

@eustlb
Copy link
Contributor

eustlb commented Dec 18, 2024

Closing as it was fixed in #34135 ! 🤗

@eustlb eustlb closed this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants