Fix: Return tuple ('', []) when char_list is empty to prevent ValueError (#1857)

This commit fixes an issue where an empty char_list causes a ValueError due to insufficient values to unpack. The function now returns a tuple ('', []) when char_list is empty.
This commit is contained in:
lingji-yidong 2024-06-28 01:28:24 +08:00 committed by GitHub
parent 3c50a034b2
commit c880db5364
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@ import numpy as np
def time_stamp_lfr6_onnx(us_cif_peak, char_list, begin_time=0.0, total_offset=-1.5):
if not len(char_list):
return []
return "", []
START_END_THRESHOLD = 5
MAX_TOKEN_DURATION = 30
TIME_RATE = 10.0 * 6 / 1000 / 3 # 3 times upsampled