Skip to content

Commit

Permalink
fix condition_on_previous_text (#1224)
Browse files Browse the repository at this point in the history
prompt_reset_since is set before all_tokens is extended hence does not have the expected effect.
  • Loading branch information
funboarder13920 authored May 5, 2023
1 parent 7ca9fbe commit 248b6cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 248b6cb

Please sign in to comment.