Skip to content

Fix: honor repetition_penalty in Whisper decoding options - #918

Merged
lucasnewman merged 1 commit into
Blaizzy:mainfrom
monai:fix/repetition-penalty-dropped
Aug 29, 2026
Merged

lucasnewman merged 1 commit into
Blaizzy:mainfrom
monai:fix/repetition-penalty-dropped

Conversation

@monai

@monai monai commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

DecodingOptions.repetition_penalty does nothing. No logit filter reads it. Cause: #873 allows kwargs by dataclass field, not by real use. Same bug as #530.

repetition_penalty works in transformers (RepetitionPenaltyLogitsProcessor) and in faster-whisper (added in v0.8.0, SYSTRAN/faster-whisper#478). Note: openai/whisper does not support this option. This fix matches those other backends, not openai/whisper.

Adds a RepetitionPenalty logit filter (divide/multiply, like HF) and uses it when options.repetition_penalty is set.

Found during an ASR accuracy check. Helps lower WER, together with #919 and #920.

@lucasnewman

lucasnewman commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

@monai Thanks! Can you sign your commits and force push so we can clear the merge requirements? Also make sure to format with pre-commit run --all

@monai
monai force-pushed the fix/repetition-penalty-dropped branch 2 times, most recently from 17aba85 to 289aa2a Compare August 29, 2026 10:05
@monai
monai marked this pull request as draft August 29, 2026 10:21
DecodingOptions declared a repetition_penalty field but no logit
filter used it, so the setting was silently ignored during decoding.

Add a RepetitionPenalty logit filter (HF-style: divide the logit by
the penalty when positive, else multiply) and wire it into
DecodingTask's filter list whenever options.repetition_penalty is
set, matching the behavior of Hugging Face transformers' Whisper
generation pipeline.
@monai
monai force-pushed the fix/repetition-penalty-dropped branch from b4fd89c to 6e570c8 Compare August 29, 2026 10:29
@monai
monai marked this pull request as ready for review August 29, 2026 10:31
@monai

monai commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

@monai Thanks! Can you sign your commits and force push so we can clear the merge requirements? Also make sure to format with pre-commit run --all

Signed and pre-commit hooks all green locally.

@lucasnewman
lucasnewman merged commit 1132af6 into Blaizzy:main Aug 29, 2026
15 checks passed
@monai
monai deleted the fix/repetition-penalty-dropped branch August 29, 2026 21:33
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