From 931b578899ddeb1d668c3bc86c0792febe945e9e Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Thu, 11 Jul 2024 21:45:38 +0800 Subject: [PATCH] Add repetition_penalty parameter to stream_builder function --- whisper_fastapi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/whisper_fastapi.py b/whisper_fastapi.py index 534d1ec..90eaf8f 100644 --- a/whisper_fastapi.py +++ b/whisper_fastapi.py @@ -120,6 +120,7 @@ def stream_builder( vad_filter: bool, language: str | None, initial_prompt: str = "", + repetition_penalty: float = 1.0, ) -> Tuple[Iterable[Segment], TranscriptionInfo]: segments, info = transcriber.model.transcribe( audio=audio, @@ -127,6 +128,7 @@ def stream_builder( task=task, initial_prompt=initial_prompt, word_timestamps=True, + repetition_penalty=repetition_penalty, ) print( "Detected language '%s' with probability %f"