From 248b6cb124225dd263bb9bd32d060b6517e067f8 Mon Sep 17 00:00:00 2001 From: Valentin Berkes <16121857+funboarder13920@users.noreply.github.com> Date: Fri, 5 May 2023 09:31:35 +0200 Subject: [PATCH] fix condition_on_previous_text (#1224) prompt_reset_since is set before all_tokens is extended hence does not have the expected effect. --- whisper/transcribe.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/whisper/transcribe.py b/whisper/transcribe.py index cba59ecfa..ff73a5530 100644 --- a/whisper/transcribe.py +++ b/whisper/transcribe.py @@ -312,10 +312,6 @@ def new_segment( ) seek += segment_size - if not condition_on_previous_text or result.temperature > 0.5: - # do not feed the prompt tokens if a high temperature was used - prompt_reset_since = len(all_tokens) - if word_timestamps: add_word_timestamps( segments=current_segments, @@ -361,6 +357,10 @@ def new_segment( [token for segment in current_segments for token in segment["tokens"]] ) + if not condition_on_previous_text or result.temperature > 0.5: + # do not feed the prompt tokens if a high temperature was used + prompt_reset_since = len(all_tokens) + # update progress bar pbar.update(min(content_frames, seek) - previous_seek)