Skip to content

Commit 248b6cb

Browse files
fix condition_on_previous_text (#1224)
prompt_reset_since is set before all_tokens is extended hence does not have the expected effect.
1 parent 7ca9fbe commit 248b6cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

whisper/transcribe.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,6 @@ def new_segment(
312312
)
313313
seek += segment_size
314314

315-
if not condition_on_previous_text or result.temperature > 0.5:
316-
# do not feed the prompt tokens if a high temperature was used
317-
prompt_reset_since = len(all_tokens)
318-
319315
if word_timestamps:
320316
add_word_timestamps(
321317
segments=current_segments,
@@ -361,6 +357,10 @@ def new_segment(
361357
[token for segment in current_segments for token in segment["tokens"]]
362358
)
363359

360+
if not condition_on_previous_text or result.temperature > 0.5:
361+
# do not feed the prompt tokens if a high temperature was used
362+
prompt_reset_since = len(all_tokens)
363+
364364
# update progress bar
365365
pbar.update(min(content_frames, seek) - previous_seek)
366366

0 commit comments

Comments
 (0)