Skip to content

Commit f8a7ecc

Browse files
author
Hainan Xu
committed
small fixes
Signed-off-by: Hainan Xu <[email protected]>
1 parent d420c27 commit f8a7ecc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nemo/collections/asr/parts/utils/streaming_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ def transcribe(
13271327
longer_ids, longer_toks = self._alignment_decoder(longer_alignment, self.asr_model.tokenizer, self.blank_id)
13281328
ids, toks = self._alignment_decoder(alignment, self.asr_model.tokenizer, self.blank_id)
13291329

1330-
if len(ids) > 0 and a_idx < signal_end_idx:
1330+
if len(longer_ids) > 0 and a_idx < signal_end_idx:
13311331
if a_idx == 0 or len(self.unmerged[idx]) == 0:
13321332
self.unmerged[idx] = inplace_buffer_merge(
13331333
self.unmerged[idx],
@@ -1337,8 +1337,8 @@ def transcribe(
13371337
)
13381338
elif len(self.unmerged[idx]) > 0 and len(longer_toks) > 1:
13391339
id_to_match = self.unmerged[idx][-1]
1340-
start = len(longer_ids) - len(ids)
1341-
end = max(-1, start - self.tdt_search_boundary)
1340+
start = min(len(longer_ids) - len(ids), len(longer_ids) - 1)
1341+
end = -1
13421342
for i in range(start, end, -1):
13431343
if longer_ids[i] == id_to_match:
13441344
ids = longer_ids[i+1:]

0 commit comments

Comments
 (0)