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

copy Whisper generate_with_fallback kwargs #29434

Closed
wants to merge 2 commits into from

Conversation

udeepam
Copy link

@udeepam udeepam commented Mar 4, 2024

What does this PR do?

The Whisper longform audio decoding strategy (from the paper) is for each audio segment:

  1. Beam search with beam_size=5 using log probabilities as the scoring function.
    • GenerationMode.BEAM_SEARCH
  2. If average log probability over the generated tokens is lower than -1 or the generated text has a gzip compression rate higher than 2.4:
    • Fallback to sampling with temperature increased by 0.2 up to 1.0
    • GenerationMode.SAMPLE

However because the kwargs to generate_with_fallback() are not copied, if on the first audio segment we fallback the num_beams parameter in the kwargs get removed.

generation_config.num_beams = kwargs.pop("num_beams", 1) if not generation_config.do_sample else 1

Hence for the second audio segment we start with GenerationMode.SAMPLE instead of GenerationMode.BEAM_SEARCH.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@sanchit-gandhi

@udeepam udeepam changed the title copy whisper generate kwargs copy whisper generate_with_fallback kwargs Mar 4, 2024
@udeepam udeepam changed the title copy whisper generate_with_fallback kwargs copy Whisper generate_with_fallback kwargs Mar 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@ArthurZucker
Copy link
Collaborator

I think this was fixed by #29225

Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot closed this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants