From c880db53646ab9fd26417f4baf004ab44cc24e1a Mon Sep 17 00:00:00 2001 From: lingji-yidong <75744976+lingji-yidong@users.noreply.github.com> Date: Fri, 28 Jun 2024 01:28:24 +0800 Subject: [PATCH] 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. --- runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py b/runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py index c8ba5a7e0..945bcace3 100644 --- a/runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py +++ b/runtime/python/onnxruntime/funasr_onnx/utils/timestamp_utils.py @@ -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