OpenNMT / OpenNMT/CTranslate2

why whisper max_length set to total_max_length / 2 when prompt is short?

Open
#1,856 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
4.7k
Forks
536
Avg merge
12h 12m
Merged PRs (30d)
4

Description

I found that when using Whisper, if I set total_max_length to 448 and the prompt length is 4, the max_length is only 224.
This might be due to the following code in whisper.cc :

decoding_options.max_length = std::min(total_max_length / 2, total_max_length - start_step);

I would like to ask why it is set to total_max_length / 2 instead of total_max_length - start_step ?
Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in whisper.cc at the decoding_options.max_length assignment and trace how total_max_length, start_step, and the prompt length are computed. Determine whether the total_max_length / 2 cap is intentional for Whisper decoding; done means the rationale is established and any necessary behavior change is covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.