Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion faster_whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ def generate_segments(
clip_idx = 0
seek = seek_clips[clip_idx][0]
all_tokens = []
all_prompt_text = []
prompt_reset_since = 0

if options.initial_prompt is not None:
Expand Down Expand Up @@ -1293,7 +1294,13 @@ def next_words_segment(segments: List[dict]) -> Optional[dict]:
if segment["start"] == segment["end"] or not text.strip():
continue

all_tokens.extend(tokens)
check_prompt_num = 1
if all(
text.strip() != i.strip()
for i in all_prompt_text[-check_prompt_num:]
):
all_tokens.extend(tokens)
all_prompt_text.append(text)
idx += 1

yield Segment(
Expand Down