PaddlePaddle / PaddleSpeech

Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award.
https://paddlespeech.readthedocs.io
Apache License 2.0
10.55k stars 1.81k forks source link

Multi-thread call paddlespeech_client asr, server raise Exception: You need to initialize the beam_search_decoder firstly #3410

Open Scisaga opened 11 months ago

Scisaga commented 11 months ago

重现步骤

  1. 启动服务端

    paddlespeech_server start --config_file config.yaml
    • 配置文件:
      
      host: 0.0.0.0
      port: 5000
      protocol: 'http'
      engine_list: ['asr_python', 'text_python']

    asr_python: model: 'deepspeech2online_wenetspeech' lang: 'zh' sample_rate: 16000 cfg_path: # [optional] ckpt_path: # [optional] decode_method: 'attention_rescoring' num_decoding_left_chunks: -1 force_yes: True device: 'cpu'

    text_python: task: punc model_type: 'ernie_linear_p3_wudao' lang: 'zh' sample_rate: 16000 cfg_path: # [optional] ckpt_path: # [optional] vocab_file: # [optional] device: 'cpu' # set 'gpu:id' or 'cpu'

  2. 在两个shell中同时运行
    paddlespeech_client asr --server_ip 127.0.0.1 --port 5000 --input cache/AxC9es3hCYFfiauh-0000.wav
  3. shell1正确获得识别结果,shell2报错
  4. 服务端异常
    [2023-07-20 23:59:38,693] [    INFO] - You need to initialize the beam_search_decoder firstly
    Traceback (most recent call last):
    File "/opt/conda/lib/python3.10/site-packages/paddlespeech/server/engine/asr/python/asr_engine.py", line 120, in run
    self.infer(self.asr_engine.config.model)
    File "/opt/conda/lib/python3.10/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
    File "/opt/conda/lib/python3.10/site-packages/paddle/fluid/dygraph/base.py", line 347, in _decorate_function
    return func(*args, **kwargs)
    File "/opt/conda/lib/python3.10/site-packages/paddlespeech/cli/asr/infer.py", line 306, in infer
    result_transcripts = self.model.decode(audio, audio_len)
    File "/opt/conda/lib/python3.10/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
    File "/opt/conda/lib/python3.10/site-packages/paddle/fluid/dygraph/base.py", line 347, in _decorate_function
    return func(*args, **kwargs)
    File "/opt/conda/lib/python3.10/site-packages/paddlespeech/s2t/models/ds2/deepspeech2.py", line 303, in decode
    self.decoder.reset_decoder(batch_size=batch_size)
    File "/opt/conda/lib/python3.10/site-packages/paddlespeech/s2t/modules/ctc.py", line 463, in reset_decoder
    raise Exception(
    Exception: You need to initialize the beam_search_decoder firstly

通过什么方式进行配置可以有效的进行多线程调用?是否与以下信息有关?

!!! Since PaddlePaddle support 0-D tensor from 2.5.0, PaddleSpeech Static model will not work for it, please re-export static model.
zxcd commented 11 months ago

目前不支持进行多线程调用,跟您提到的错误信息无关。

stale[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.