Prechádzať zdrojové kódy

update docs; update run_server.sh; fix initlm

雾聪 2 rokov pred
rodič
commit
6d6c6e3c79

+ 5 - 1
runtime/onnxruntime/readme.md

@@ -53,4 +53,8 @@ mkdir build
 cd build
 cmake ../ -D FFMPEG_DIR=d:/ffmpeg-master-latest-win64-gpl-shared -D ONNXRUNTIME_DIR=d:/onnxruntime-win-x64-1.16.1
 ```
-Visual Studio open FunASR/runtime/onnxruntime/build/FunASROnnx.sln start build
+
+Visual Studio open FunASR/runtime/onnxruntime/build/FunASROnnx.sln start build. 
+After compilation, the executable file is located here: FunASR/runtime/onnxruntime/build/bin/Debug.
+Copy the required DLL libraries from (onnxruntime-win-x64-1.16.1/lib, ffmpeg-master-latest-win64-gpl-shared/bin) to this location: FunASR/runtime/onnxruntime/build/bin/Debug
+

+ 7 - 3
runtime/onnxruntime/src/paraformer.cpp

@@ -191,9 +191,13 @@ void Paraformer::InitLm(const std::string &lm_file,
     try {
         lm_ = std::shared_ptr<fst::Fst<fst::StdArc>>(
             fst::Fst<fst::StdArc>::Read(lm_file));
-        if (vocab) { delete vocab; }
-        vocab = new Vocab(lm_cfg_file.c_str());
-        LOG(INFO) << "Successfully load lm file " << lm_file;
+        if (lm_){
+            if (vocab) { delete vocab; }
+            vocab = new Vocab(lm_cfg_file.c_str());
+            LOG(INFO) << "Successfully load lm file " << lm_file;
+        }else{
+            LOG(ERROR) << "Failed to load lm file " << lm_file;
+        }
     } catch (std::exception const &e) {
         LOG(ERROR) << "Error when load lm file: " << e.what();
         exit(0);

+ 3 - 0
runtime/run_server.sh

@@ -6,6 +6,7 @@ punc_dir="damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx"
 itn_dir="thuduj12/fst_itn_zh"
 lm_dir="damo/speech_ngram_lm_zh-cn-ai-wesp-fst"
 decoder_thread_num=32
+model_thread_num=1
 io_thread_num=8
 port=10095
 certfile="../../../ssl_key/server.crt"
@@ -25,6 +26,7 @@ if [ -z "$certfile" ] || [ "$certfile" -eq 0 ]; then
   --lm-dir "${lm_dir}" \
   --decoder-thread-num ${decoder_thread_num} \
   --io-thread-num  ${io_thread_num} \
+  --model-thread-num ${model_thread_num} \
   --port ${port} \
   --certfile  "" \
   --keyfile "" \
@@ -38,6 +40,7 @@ else
   --itn-dir "${itn_dir}" \
   --lm-dir "${lm_dir}" \
   --decoder-thread-num ${decoder_thread_num} \
+  --model-thread-num ${model_thread_num} \
   --io-thread-num  ${io_thread_num} \
   --port ${port} \
   --certfile  "${certfile}" \

+ 3 - 0
runtime/run_server_2pass.sh

@@ -6,6 +6,7 @@ vad_dir="damo/speech_fsmn_vad_zh-cn-16k-common-onnx"
 punc_dir="damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx"
 itn_dir="thuduj12/fst_itn_zh"
 decoder_thread_num=32
+model_thread_num=1
 io_thread_num=8
 port=10095
 certfile="../../../ssl_key/server.crt"
@@ -24,6 +25,7 @@ if [ -z "$certfile" ] || [ "$certfile" -eq 0 ]; then
   --punc-dir "${punc_dir}" \
   --itn-dir "${itn_dir}" \
   --decoder-thread-num ${decoder_thread_num} \
+  --model-thread-num ${model_thread_num} \
   --io-thread-num  ${io_thread_num} \
   --port ${port} \
   --certfile  "" \
@@ -38,6 +40,7 @@ else
   --punc-dir "${punc_dir}" \
   --itn-dir "${itn_dir}" \
   --decoder-thread-num ${decoder_thread_num} \
+  --model-thread-num ${model_thread_num} \
   --io-thread-num  ${io_thread_num} \
   --port ${port} \
   --certfile  "${certfile}" \

+ 3 - 1
runtime/websocket/readme_zh.md

@@ -72,5 +72,7 @@ mkdir build
 cd build
 cmake ../ -D OPENSSL_ROOT_DIR=d:/openssl-1.1.1w -D FFMPEG_DIR=d:/ffmpeg-master-latest-win64-gpl-shared -D ONNXRUNTIME_DIR=d:/onnxruntime-win-x64-1.16.1
 ```
-Visual Studio 打开 FunASR/runtime/websocket/build/FunASRWebscoket.sln 完成编译
+Visual Studio 打开 FunASR/runtime/websocket/build/FunASRWebscoket.sln 完成编译;
+编译后的可执行文件位于:FunASR/runtime/websocket/build/bin/Debug;
+从 onnxruntime-win-x64-1.16.1/lib, ffmpeg-master-latest-win64-gpl-shared/bin copy相关的DLL库至: FunASR/runtime/onnxruntime/build/bin/Debug