modelscope / FunASR

A Fundamental End-to-End Speech Recognition Toolkit and Open Source SOTA Pretrained Models, Supporting Speech Recognition, Voice Activity Detection, Text Post-processing etc.
https://www.funasr.com
Other
6.18k stars 657 forks source link

同一进程中,多次调用时,会累加输出结果 #1269

Closed ws89 closed 8 months ago

ws89 commented 8 months ago

🐛 Bug

当在同一个进程中,多次调用识别方法时,会进行多次识别并将结果累加

To Reproduce

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

  1. 我在同一进程中,不同时间多次调用,最后一次输出的结果是 「实际结果 * 第几次调用」,具体可以截图示例。
image

Code sample

from funasr import AutoModel
# paraformer-zh is a multi-functional asr model
# use vad, punc, spk or not as you need
model = AutoModel(model="paraformer-zh", model_revision="v2.0.2", \
                  vad_model="fsmn-vad", vad_model_revision="v2.0.2", \
                  punc_model="ct-punc-c", punc_model_revision="v2.0.2", \
                  spk_model="cam++", spk_model_revision="v2.0.2")

res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", 
            batch_size=64, 
            hotword='魔搭')
print("第一次调用",res[0]['text_with_punc'])

res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav",
            batch_size=64,
            hotword='魔搭')
print("第二次调用",res[0]['text_with_punc'])

Expected behavior

我期望每次调用都产生正确的结果,而不是重复识别多次。

Environment

Additional context

pip list Package Version Editable project location


addict 2.4.0 aiohttp 3.9.1 aiosignal 1.3.1 aliyun-python-sdk-core 2.14.0 aliyun-python-sdk-kms 2.16.2 antlr4-python3-runtime 4.9.3 async-timeout 4.0.3 attrs 23.2.0 audioread 3.0.1 blinker 1.7.0 certifi 2023.11.17 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 crcmod 1.7 cryptography 41.0.7 Cython 0.29.37 datasets 2.16.1 decorator 5.1.1 dill 0.3.7 editdistance 0.6.2 einops 0.7.0 filelock 3.13.1 Flask 3.0.0 frozenlist 1.4.1 fsspec 2023.10.0 funasr 1.0.0 /app/FunASR gast 0.5.4 hdbscan 0.8.33 huggingface-hub 0.20.2 hydra-core 1.3.2 idna 3.6 importlib-metadata 7.0.1 importlib-resources 6.1.1 itsdangerous 2.1.2 jaconv 0.3.4 jamo 0.4.1 jieba 0.42.1 Jinja2 3.1.3 jmespath 0.10.0 joblib 1.3.2 kaldiio 2.18.0 lazy_loader 0.3 librosa 0.10.1 llvmlite 0.41.1 MarkupSafe 2.1.3 modelscope 1.11.0 mpmath 1.3.0 msgpack 1.0.7 multidict 6.0.4 multiprocess 0.70.15 networkx 3.1 numba 0.58.1 numpy 1.24.4 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu12 8.9.2.26 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu12 2.18.1 nvidia-nvjitlink-cu12 12.3.101 nvidia-nvtx-cu12 12.1.105 omegaconf 2.3.0 oss2 2.18.4 packaging 23.2 pandas 2.0.3 pillow 10.2.0 pip 23.3.2 platformdirs 4.1.0 pooch 1.8.0 pyarrow 14.0.2 pyarrow-hotfix 0.6 pycparser 2.21 pycryptodome 3.20.0 python-dateutil 2.8.2 pytorch-wpe 0.0.1 pytz 2023.3.post1 PyYAML 6.0.1 requests 2.31.0 scikit-learn 1.3.2 scipy 1.10.1 sentencepiece 0.1.99 setuptools 57.5.0 simplejson 3.19.2 six 1.16.0 sortedcontainers 2.4.0 soundfile 0.12.1 soxr 0.3.7 sympy 1.12 threadpoolctl 3.2.0 tomli 2.0.1 torch 2.1.2 torch-complex 0.4.3 torchaudio 2.1.2 tqdm 4.66.1 triton 2.1.0 typing_extensions 4.9.0 tzdata 2023.4 umap 0.1.1 urllib3 2.1.0 Werkzeug 3.0.1 wheel 0.40.0 xxhash 3.4.1 yapf 0.40.2 yarl 1.9.4 zipp 3.17.0

LauraGPT commented 8 months ago

Yeah, it is a bug. We will fix it soon.

LauraGPT commented 8 months ago

Bug has been fixed, please update funasr and try it again.

ws89 commented 8 months ago

已验证,感谢作者。