wenet icon indicating copy to clipboard operation
wenet copied to clipboard

python performance issues

Open tuocheng0824 opened this issue 2 years ago • 4 comments

The python interface provided by wenet can only be executed in a single thread, right? The original C++ code needs to load and read the model every time a Decoder object is created. It does not support creating multiple Decoders in the same thread. If I want to support multi-threading, I should How to modify?

tuocheng0824 avatar Jul 22 '22 08:07 tuocheng0824

You need make the decoder to have the function of copying like feature pipeline etc, by the way, the model can be multi-threaded

Mddct avatar Jul 23 '22 00:07 Mddct

Every time this Recognizer is created, the model must be loaded once. If multiple recognizers are created, there will be multiple copies of the model in the memory. It takes time to read the model, and the model itself takes up memory. wenet2

tuocheng0824 avatar Jul 25 '22 03:07 tuocheng0824

The interface provided by python is called Decoder. This decoder does not support multi-threading for different recognition tasks at the same time, so I want to create multiple Decoders for concurrent recognition, but this will make an error

tuocheng0824 avatar Jul 25 '22 03:07 tuocheng0824

python 的 decoder不支持同时多线程处理不同的识别任务,我这也遇到这样的问题,具体报错信息如下:

Error: cannot set number of interop threads after parallel work has started or  set_num_interop_threads called

现在有好的解决办法吗

java-code-former avatar Sep 19 '22 03:09 java-code-former

please try c++ runtime, which natively support multi-thread

xingchensong avatar Feb 21 '23 04:02 xingchensong