Skip to content

Commit

Permalink
fix a small issue in OWSM decode_long
Browse files Browse the repository at this point in the history
  • Loading branch information
jctian98 committed Mar 15, 2024
1 parent d004740 commit c351239
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion espnet2/bin/s2t_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,12 @@ def decode_long(
text_prev = init_text
while offset < len(speech):
logging.info(f"Current start time in seconds: {offset / fs:.2f}")
if offset + segment_len > len(speech) and len(segment) / fs < 0.2:
logging.warning(
f"Skip the last clip as it's too short: {len(segment)/ fs:.2f}s"
)
offset += segment_len
continue

segment = speech[offset : offset + segment_len]
# segment will be padded in __call__
Expand Down Expand Up @@ -641,7 +647,6 @@ def decode_long(
utterances.append(utt)

offset += round((new_start_time_id - first_time_id) * resolution * fs)
self.time_id = first_time_id

return utterances

Expand Down

0 comments on commit c351239

Please sign in to comment.