Skip to content

Commit

Permalink
[fix] fix paraformer search.py (wenet-e2e#2580)
Browse files Browse the repository at this point in the history
* [fix] fix paraformer search.py

* fix lint
  • Loading branch information
pengzhendong authored Jul 22, 2024
1 parent eae7656 commit 08b031b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions wenet/paraformer/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ def gen_timestamps_from_peak(cif_peaks: List[int],
else:
split = fire_place[i] + MAX_TOKEN_DURATION
times.append([fire_place[i] * frame_rate, split * frame_rate])
if num_frames - fire_place[-1] > START_END_THRESHOLD:
end = (num_frames + fire_place[-1]) * 0.5
times[-1][1] = end * frame_rate
times.append([end * frame_rate, num_frames * frame_rate])
else:
times[-1][1] = num_frames * frame_rate
if len(times) > 0:
if num_frames - fire_place[-1] > START_END_THRESHOLD:
end = (num_frames + fire_place[-1]) * 0.5
times[-1][1] = end * frame_rate
times.append([end * frame_rate, num_frames * frame_rate])
else:
times[-1][1] = num_frames * frame_rate
return times


Expand Down

0 comments on commit 08b031b

Please sign in to comment.