[Whisper] another patch (#21324)

* another patch

* fix timestamp test modeling

* let it be negative when the token is None
This commit is contained in:
Arthur
2023-01-27 16:35:16 +01:00
committed by GitHub
parent e5eb3e22ea
commit 0dff407d71
3 changed files with 5 additions and 6 deletions

View File

@@ -101,7 +101,7 @@ def _find_timestamp_sequence(sequences, tokenizer, feature_extractor, max_source
chunk_len, stride_left, stride_right = stride
sequence = sequence.squeeze(0)
# get rid of the `forced_decoder_idx` that are use to parametrize the generation
begin_idx = np.where(sequence == timestamp_begin)[0].item() if timestamp_begin in sequence else 0
begin_idx = np.where(sequence == timestamp_begin)[0][0] if timestamp_begin in sequence else 0
sequence = sequence[begin_idx:]
timestamp_tokens = sequence >= timestamp_begin