From 14a7cab8eb514fa1844b87dbccf8f6bb22bce2df Mon Sep 17 00:00:00 2001 From: Jakub Kukul Date: Sat, 14 Oct 2023 12:44:36 +0200 Subject: [PATCH] Pass patience and beam_size to faster-whisper. --- whisperx/asr.py | 2 ++ whisperx/transcribe.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/whisperx/asr.py b/whisperx/asr.py index 27de6db..1734fb9 100644 --- a/whisperx/asr.py +++ b/whisperx/asr.py @@ -145,6 +145,8 @@ class WhisperModel(faster_whisper.WhisperModel): result = self.model.generate( encoder_output, [prompt] * batch_size, + beam_size=options.beam_size, + patience=options.patience, length_penalty=options.length_penalty, max_length=self.max_length, suppress_blank=options.suppress_blank, diff --git a/whisperx/transcribe.py b/whisperx/transcribe.py index 8a8db13..87de764 100644 --- a/whisperx/transcribe.py +++ b/whisperx/transcribe.py @@ -51,7 +51,7 @@ def cli(): parser.add_argument("--temperature", type=float, default=0, help="temperature to use for sampling") parser.add_argument("--best_of", type=optional_int, default=5, help="number of candidates when sampling with non-zero temperature") parser.add_argument("--beam_size", type=optional_int, default=5, help="number of beams in beam search, only applicable when temperature is zero") - parser.add_argument("--patience", type=float, default=None, help="optional patience value to use in beam decoding, as in https://arxiv.org/abs/2204.05424, the default (1.0) is equivalent to conventional beam search") + parser.add_argument("--patience", type=float, default=1.0, help="optional patience value to use in beam decoding, as in https://arxiv.org/abs/2204.05424, the default (1.0) is equivalent to conventional beam search") parser.add_argument("--length_penalty", type=float, default=1.0, help="optional token length penalty coefficient (alpha) as in https://arxiv.org/abs/1609.08144, uses simple length normalization by default") parser.add_argument("--suppress_tokens", type=str, default="-1", help="comma-separated list of token ids to suppress during sampling; '-1' will suppress most special characters except common punctuations")