Skip to content

Commit

Permalink
Fix aligner error
Browse files Browse the repository at this point in the history
See shashikg#59 (comment)

Error: No position encodings are defined for positions >= 448, but got position 454
  • Loading branch information
brunjo committed May 26, 2024
1 parent 5b15bcf commit ada246a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion whisper_s2t/backends/tensorrt/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,11 @@ def align_words(self, features, texts, text_tokens, sot_seqs, seq_lens, seg_meta

token_alignments = [[] for _ in seg_metadata]
for start_seq, req_idx in start_seq_wise_req.items():
adjusted_num_frames = [min(frame, MAX_TEXT_TOKEN_LENGTH) for frame in seq_lens[req_idx].detach().cpu().numpy()]
res = self.aligner_model.align(ctranslate2.StorageView.from_array(features[req_idx]),
start_sequence=list(start_seq),
text_tokens=[text_tokens[_] for _ in req_idx],
num_frames=list(seq_lens[req_idx].detach().cpu().numpy()),
num_frames=adjusted_num_frames,
median_filter_width=7)

for _res, _req_idx in zip(res, req_idx):
Expand Down

0 comments on commit ada246a

Please sign in to comment.