mirror of
https://github.com/m-bain/whisperX.git
synced 2025-07-01 18:17:27 -04:00
clamp end_timestamp to prevent infinite loop
This commit is contained in:
@ -269,6 +269,10 @@ def transcribe(
|
|||||||
end_timestamp_pos = (
|
end_timestamp_pos = (
|
||||||
sliced_tokens[-1].item() - tokenizer.timestamp_begin
|
sliced_tokens[-1].item() - tokenizer.timestamp_begin
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# clamp end-time to at least be 1 frame after start-time
|
||||||
|
end_timestamp_pos = max(end_timestamp_pos, start_timestamp_pos + time_precision)
|
||||||
|
|
||||||
current_segments.append(
|
current_segments.append(
|
||||||
new_segment(
|
new_segment(
|
||||||
start=time_offset + start_timestamp_pos * time_precision,
|
start=time_offset + start_timestamp_pos * time_precision,
|
||||||
|
Reference in New Issue
Block a user