k2-fsa / sherpa

Speech-to-text server framework with next-gen Kaldi
https://k2-fsa.github.io/sherpa
Apache License 2.0
555 stars 109 forks source link

The client terminal cannot use the multi-process program to send data #248

Open arbs-gpu opened 1 year ago

arbs-gpu commented 1 year ago

@csukuangfj The code for this client is in
https://github.com/k2-fsa/sherpa/tree/master/triton/client/client.py

After my test, if you do not use multi-process mode, that is, send data to the server with a single thread, it can return normal recognition results. If you run the script directly (that is, use multi-process), the following error will be reported:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 576, in _handle_results
    task = get()
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
TypeError: __init__() missing 1 required positional argument: 'msg'
csukuangfj commented 1 year ago

@yuekaizhang Could you please have a look?

yuekaizhang commented 1 year ago

@csukuangfj The code for this client is in https://github.com/k2-fsa/sherpa/tree/master/triton/client/client.py

After my test, if you do not use multi-process mode, that is, send data to the server with a single thread, it can return normal recognition results. If you run the script directly (that is, use multi-process), the following error will be reported:

Exception in thread Thread-3:
Traceback (most recent call last):
 File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
   self.run()
 File "/usr/lib/python3.8/threading.py", line 870, in run
   self._target(*self._args, **self._kwargs)
 File "/usr/lib/python3.8/multiprocessing/pool.py", line 576, in _handle_results
   task = get()
 File "/usr/lib/python3.8/multiprocessing/connection.py", line 251, in recv
   return _ForkingPickler.loads(buf.getbuffer())
TypeError: __init__() missing 1 required positional argument: 'msg'

I didn't encounter this issue. Could you make sure you are using exactly same command for single-thread and multi-thread test?

Which model_repo are you using? For model_repo_offline_jit, you may use client with "--model_name conformer_transducer" rather than default "transducer".

https://github.com/k2-fsa/sherpa/blob/master/triton/client/decode_manifest_triton.py, you may modify this file for decoding with multiple audios, which using python asynio to create multi-tasks.