mirror of
https://github.com/openai/whisper.git
synced 2026-01-08 04:54:02 -05:00
Fix #1293
This commit is contained in:
@@ -215,6 +215,8 @@ def find_alignment(
|
||||
|
||||
words, word_tokens = tokenizer.split_to_word_tokens(text_tokens + [tokenizer.eot])
|
||||
word_boundaries = np.pad(np.cumsum([len(t) for t in word_tokens[:-1]]), (1, 0))
|
||||
if len(word_boundaries) <= 1:
|
||||
return []
|
||||
|
||||
jumps = np.pad(np.diff(text_indices), (1, 0), constant_values=1).astype(bool)
|
||||
jump_times = time_indices[jumps] / TOKENS_PER_SECOND
|
||||
|
||||
Reference in New Issue
Block a user