Merge pull request #12 from chatgpt-1/main

Fix: timestamp extraction bug in transcribe function
This commit is contained in:
Awni Hannun 2023-12-07 08:53:30 -08:00 committed by GitHub
commit 54952a0d80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -300,7 +300,7 @@ def transcribe(
seek += last_timestamp_pos * input_stride seek += last_timestamp_pos * input_stride
else: else:
duration = segment_duration duration = segment_duration
timestamps = tokens[timestamp_tokens.nonzero().flatten()] timestamps = tokens[timestamp_tokens.nonzero()[0]]
if ( if (
len(timestamps) > 0 len(timestamps) > 0
and timestamps[-1].item() != tokenizer.timestamp_begin and timestamps[-1].item() != tokenizer.timestamp_begin