FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

后处理会抛IndexError异常

Open yzmyyff opened this issue 1 year ago • 0 comments

Notice: In order to resolve issues more efficiently, please raise issue following the template. (注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)

🐛 Bug

某些情况后处理会抛IndexError异常

To Reproduce

Steps to reproduce the behavior (always include the command you ran):

  1. Run cmd '....'
from funasr.utils import postprocess_utils

token = ['答', '案', '是', '1', '.', '5']

timestamp = [[190, 370], [370, 490], [490, 730], [790, 950],
                     [950, 1110], [1110, 1495]]

postprocess_utils.sentence_postprocess(token, timestamp)
  1. See error
Traceback (most recent call last):
  File "/data/vjuicefs_speech_tts_v3/11146693/gitlab/testset_exception/tests.py", line 24, in test_funasr
    postprocess_utils.sentence_postprocess(token, timestamp)
  File "/data/vjuicefs_speech_tts_v3/11146693/github/FunASR/funasr/utils/postprocess_utils.py", line 235, in sentence_postprocess
    word_lists, ts_lists = abbr_dispose(word_lists, ts_lists)
  File "/data/vjuicefs_speech_tts_v3/11146693/github/FunASR/funasr/utils/postprocess_utils.py", line 131, in abbr_dispose
    begin = time_stamp[ts_nums[num]][0]
IndexError: list index out of range

Code sample

Expected behavior

没有异常

Environment

  • OS (e.g., Linux): Linux
  • FunASR Version (e.g., 1.0.0): main head
  • ModelScope Version (e.g., 1.11.0): 1.13.3
  • PyTorch Version (e.g., 2.0.0):
  • How you installed funasr (pip, source): source.
  • Python version: 2.2.1+cu118
  • GPU (e.g., V100M32): L40s
  • CUDA/cuDNN version (e.g., cuda11.7): 11.8
  • Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1)
  • Any other relevant information:

Additional context

yzmyyff avatar May 07 '24 11:05 yzmyyff