Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#33512 handle last element out of range error #33625

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions src/transformers/models/whisper/tokenization_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,9 +1057,9 @@ def new_chunk():
start_time = round(token_timestamps[i] + time_offset, 2)
if i + 1 < len(token_timestamps):
end_time = round(token_timestamps[i + 1] + time_offset, 2)
current_token_timestamps.append((start_time, end_time))
else:
end_time = None # should never happen
current_token_timestamps.append((start_time, end_time))

if "stride" in output:
time_offset += chunk_len - stride_right
Expand Down Expand Up @@ -1192,7 +1192,7 @@ def _find_longest_common_sequence(sequences, token_timestamp_sequences=None):
# and have timestamps that are in order
matches = sum(
1
for idx, elem in enumerate(left)
for idx, elem in enumerate(left[:-1])
if (
elem == right[idx]
and left_token_timestamp_sequence[left_start + idx]
Expand Down
Loading