From bd9ed054110636a0a2fa065fd851d19e444b9505 Mon Sep 17 00:00:00 2001 From: lyblsgo <wucong.lyb@alibaba-inc.com> Date: 星期三, 11 十月 2023 19:47:18 +0800 Subject: [PATCH] update docs for server instructions --- funasr/runtime/docs/SDK_advanced_guide_online.md | 76 +++++++++--- funasr/runtime/docs/SDK_advanced_guide_offline_en_zh.md | 66 +++++------ funasr/runtime/docs/SDK_advanced_guide_offline.md | 52 ++++--- funasr/runtime/docs/SDK_advanced_guide_offline_en.md | 47 ++++--- funasr/runtime/docs/SDK_advanced_guide_offline_zh.md | 66 ++++------ funasr/runtime/docs/SDK_advanced_guide_online_zh.md | 48 ++++++- 6 files changed, 208 insertions(+), 147 deletions(-) diff --git a/funasr/runtime/docs/SDK_advanced_guide_offline.md b/funasr/runtime/docs/SDK_advanced_guide_offline.md index 63276eb..a674b9b 100644 --- a/funasr/runtime/docs/SDK_advanced_guide_offline.md +++ b/funasr/runtime/docs/SDK_advanced_guide_offline.md @@ -49,7 +49,6 @@ ``` - ## Starting the server Use the flollowing script to start the server 锛� @@ -65,15 +64,16 @@ # If you want to deploy the timestamp or hotword model, please set --model-dir to the corresponding model: # speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx锛坱imestamp锛� # damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx锛坔otword锛� + ``` -More details about the script run_server.sh: +### More details about the script run_server.sh: -The FunASR-wss-server supports downloading models from Modelscope. You can set the model download address (--download-model-dir, default is /workspace/models) and the model ID (--model-dir, --vad-dir, --punc-dir). Here is an example: +The funasr-wss-server supports downloading models from Modelscope. You can set the model download address (--download-model-dir, default is /workspace/models) and the model ID (--model-dir, --vad-dir, --punc-dir). Here is an example: ```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ +cd /workspace/FunASR/funasr/runtime +nohup bash run_server.sh \ --download-model-dir /workspace/models \ --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ @@ -83,10 +83,10 @@ --io-thread-num 8 \ --port 10095 \ --certfile ../../../ssl_key/server.crt \ - --keyfile ../../../ssl_key/server.key + --keyfile ../../../ssl_key/server.key > log.out 2>&1 & ``` -Introduction to command parameters: +Introduction to run_server.sh parameters: ```text --download-model-dir: Model download address, download models from Modelscope by setting the model ID. @@ -100,25 +100,31 @@ --port: Port number that the server listens on. Default is 10095. --decoder-thread-num: Number of inference threads that the server starts. Default is 8. --io-thread-num: Number of IO threads that the server starts. Default is 1. ---certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close ssl锛宻et "" ---keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. If you want to close ssl锛宻et "" +--certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close ssl锛宻et 0 +--keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. ``` -The FunASR-wss-server also supports loading models from a local path (see Preparing Model Resources for detailed instructions on preparing local model resources). Here is an example: +### Shutting Down the FunASR Service +```text +# Check the PID of the funasr-wss-server process +ps -x | grep funasr-wss-server +kill -9 PID +``` -```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ - --model-dir /workspace/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ - --vad-dir /workspace/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ - --punc-dir /workspace/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \ - --itn-dir /workspace/models/thuduj12/fst_itn_zh \ - --decoder-thread-num 32 \ - --io-thread-num 8 \ - --port 10095 \ - --certfile ../../../ssl_key/server.crt \ - --keyfile ../../../ssl_key/server.key - ``` +### Modifying Models and Other Parameters +To replace the currently used model or other parameters, you need to first shut down the FunASR service, make the necessary modifications to the parameters you want to replace, and then restart the FunASR service. The model should be either an ASR/VAD/PUNC model from ModelScope or a fine-tuned model obtained from ModelScope. +```text +# For example, to replace the ASR model with damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx, use the following parameter setting --model-dir + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx +# Set the port number using --port + --port <port number> +# Set the number of inference threads the server will start using --decoder-thread-num + --decoder-thread-num <decoder thread num> +# Set the number of IO threads the server will start using --io-thread-num + --io-thread-num <io thread num> +# Disable SSL certificate + --certfile 0 +``` After executing the above command, the real-time speech transcription service will be started. If the model is specified as a ModelScope model id, the following models will be automatically downloaded from ModelScope: [FSMN-VAD](https://www.modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx/summary) diff --git a/funasr/runtime/docs/SDK_advanced_guide_offline_en.md b/funasr/runtime/docs/SDK_advanced_guide_offline_en.md index cf460aa..6c12fec 100644 --- a/funasr/runtime/docs/SDK_advanced_guide_offline_en.md +++ b/funasr/runtime/docs/SDK_advanced_guide_offline_en.md @@ -64,13 +64,13 @@ ``` -More details about the script run_server.sh: +### More details about the script run_server.sh: -The FunASR-wss-server supports downloading models from Modelscope. You can set the model download address (--download-model-dir, default is /workspace/models) and the model ID (--model-dir, --vad-dir, --punc-dir). Here is an example: +The funasr-wss-server supports downloading models from Modelscope. You can set the model download address (--download-model-dir, default is /workspace/models) and the model ID (--model-dir, --vad-dir, --punc-dir). Here is an example: ```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ +cd /workspace/FunASR/funasr/runtime +nohup bash run_server.sh \ --download-model-dir /workspace/models \ --model-dir damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx \ --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ @@ -82,7 +82,7 @@ --keyfile ../../../ssl_key/server.key ``` -Introduction to command parameters: +Introduction to run_server.sh parameters: ```text --download-model-dir: Model download address, download models from Modelscope by setting the model ID. @@ -96,24 +96,31 @@ --port: Port number that the server listens on. Default is 10095. --decoder-thread-num: Number of inference threads that the server starts. Default is 8. --io-thread-num: Number of IO threads that the server starts. Default is 1. ---certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close ssl锛宻et "" ---keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. If you want to close ssl锛宻et "" +--certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close ssl锛宻et 0 +--keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. ``` -The FunASR-wss-server also supports loading models from a local path (see Preparing Model Resources for detailed instructions on preparing local model resources). Here is an example: +### Shutting Down the FunASR Service +```text +# Check the PID of the funasr-wss-server process +ps -x | grep funasr-wss-server +kill -9 PID +``` -```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ - --model-dir /workspace/models/damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx \ - --vad-dir /workspace/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ - --punc-dir /workspace/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \ - --decoder-thread-num 32 \ - --io-thread-num 8 \ - --port 10095 \ - --certfile ../../../ssl_key/server.crt \ - --keyfile ../../../ssl_key/server.key - ``` +### Modifying Models and Other Parameters +To replace the currently used model or other parameters, you need to first shut down the FunASR service, make the necessary modifications to the parameters you want to replace, and then restart the FunASR service. The model should be either an ASR/VAD/PUNC model from ModelScope or a fine-tuned model obtained from ModelScope. +```text +# For example, to replace the ASR model with damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx, use the following parameter setting --model-dir + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx +# Set the port number using --port + --port <port number> +# Set the number of inference threads the server will start using --decoder-thread-num + --decoder-thread-num <decoder thread num> +# Set the number of IO threads the server will start using --io-thread-num + --io-thread-num <io thread num> +# Disable SSL certificate + --certfile 0 +``` After executing the above command, the real-time speech transcription service will be started. If the model is specified as a ModelScope model id, the following models will be automatically downloaded from ModelScope: [FSMN-VAD](https://www.modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx/summary) diff --git a/funasr/runtime/docs/SDK_advanced_guide_offline_en_zh.md b/funasr/runtime/docs/SDK_advanced_guide_offline_en_zh.md index 67d8535..6835d96 100644 --- a/funasr/runtime/docs/SDK_advanced_guide_offline_en_zh.md +++ b/funasr/runtime/docs/SDK_advanced_guide_offline_en_zh.md @@ -45,7 +45,7 @@ # 濡傛灉鎮ㄦ兂鍏抽棴ssl锛屽鍔犲弬鏁帮細--certfile 0 ``` -鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔弬鏁颁粙缁峕(#鏈嶅姟绔弬鏁颁粙缁�) +鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔敤娉曡瑙(#鏈嶅姟绔敤娉曡瑙�) ### 瀹㈡埛绔祴璇曚笌浣跨敤 涓嬭浇瀹㈡埛绔祴璇曞伐鍏风洰褰晄amples @@ -148,12 +148,12 @@ -## 鏈嶅姟绔弬鏁颁粙缁嶏細 +## 鏈嶅姟绔敤娉曡瑙o細 -funasr-wss-server鏀寔浠嶮odelscope涓嬭浇妯″瀷锛岃缃ā鍨嬩笅杞藉湴鍧�锛�--download-model-dir锛岄粯璁や负/workspace/models锛夊強model ID锛�--model-dir銆�--vad-dir銆�--punc-dir锛�,绀轰緥濡備笅锛� +### 鍚姩FunASR鏈嶅姟 ```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ +cd /workspace/FunASR/funasr/runtime +nohup bash run_server.sh \ --download-model-dir /workspace/models \ --model-dir damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx \ --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ @@ -162,9 +162,9 @@ --io-thread-num 8 \ --port 10095 \ --certfile ../../../ssl_key/server.crt \ - --keyfile ../../../ssl_key/server.key + --keyfile ../../../ssl_key/server.key > log.out 2>&1 & ``` -鍛戒护鍙傛暟浠嬬粛锛� +**run_server.sh鍛戒护鍙傛暟浠嬬粛** ```text --download-model-dir 妯″瀷涓嬭浇鍦板潃锛岄�氳繃璁剧疆model ID浠嶮odelscope涓嬭浇妯″瀷 --model-dir modelscope model ID @@ -177,40 +177,34 @@ --port 鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095 --decoder-thread-num 鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8 --io-thread-num 鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1 ---certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� ---keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� +--certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负0 +--keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key ``` -funasr-wss-server鍚屾椂涔熸敮鎸佷粠鏈湴璺緞鍔犺浇妯″瀷锛堟湰鍦版ā鍨嬭祫婧愬噯澶囪瑙乕妯″瀷璧勬簮鍑嗗](#妯″瀷璧勬簮鍑嗗)锛夌ず渚嬪涓嬶細 -```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ - --model-dir /workspace/models/damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx \ - --vad-dir /workspace/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ - --punc-dir /workspace/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \ - --decoder-thread-num 32 \ - --io-thread-num 8 \ - --port 10095 \ - --certfile ../../../ssl_key/server.crt \ - --keyfile ../../../ssl_key/server.key - ``` -鍛戒护鍙傛暟浠嬬粛锛� +### 鍏抽棴FunASR鏈嶅姟 ```text ---model-dir ASR妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/asr ---quantize True涓洪噺鍖朅SR妯″瀷锛孎alse涓洪潪閲忓寲ASR妯″瀷锛岄粯璁ゆ槸True ---vad-dir VAD妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/vad ---vad-quant True涓洪噺鍖朧AD妯″瀷锛孎alse涓洪潪閲忓寲VAD妯″瀷锛岄粯璁ゆ槸True ---punc-dir PUNC妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/punc ---punc-quant True涓洪噺鍖朠UNC妯″瀷锛孎alse涓洪潪閲忓寲PUNC妯″瀷锛岄粯璁ゆ槸True ---itn-dir modelscope model ID ---port 鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095 ---decoder-thread-num 鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8 ---io-thread-num 鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1 ---certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� ---keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� +# 鏌ョ湅 funasr-wss-server 瀵瑰簲鐨凱ID +ps -x | grep funasr-wss-server +kill -9 PID ``` -鎵ц涓婅堪鎸囦护鍚庯紝鍚姩绂荤嚎鏂囦欢杞啓鏈嶅姟銆傚鏋滄ā鍨嬫寚瀹氫负ModelScope涓璵odel id锛屼細鑷姩浠嶮oldeScope涓笅杞藉涓嬫ā鍨嬶細 +### 淇敼妯″瀷鍙婂叾浠栧弬鏁� +鏇挎崲姝e湪浣跨敤鐨勬ā鍨嬫垨鑰呭叾浠栧弬鏁帮紝闇�鍏堝叧闂璅unASR鏈嶅姟锛屼慨鏀归渶瑕佹浛鎹㈢殑鍙傛暟锛屽苟閲嶆柊鍚姩FunASR鏈嶅姟銆傚叾涓ā鍨嬮渶涓篗odelScope涓殑ASR/VAD/PUNC妯″瀷锛屾垨鑰呬粠ModelScope涓ā鍨媐inetune鍚庣殑妯″瀷銆� +```text +# 渚嬪鏇挎崲ASR妯″瀷涓� damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx锛屽垯濡備笅璁剧疆鍙傛暟 --model-dir + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx +# 璁剧疆绔彛鍙� --port + --port <port number> +# 璁剧疆鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁� --decoder-thread-num + --decoder-thread-num <decoder thread num> +# 璁剧疆鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁� --io-thread-num + --io-thread-num <io thread num> +# 鍏抽棴SSL璇佷功 + --certfile 0 +``` + + +鎵ц涓婅堪鎸囦护鍚庯紝鍚姩鑻辨枃绂荤嚎鏂囦欢杞啓鏈嶅姟銆傚鏋滄ā鍨嬫寚瀹氫负ModelScope涓璵odel id锛屼細鑷姩浠嶮oldeScope涓笅杞藉涓嬫ā鍨嬶細 [FSMN-VAD妯″瀷](https://www.modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx/summary)锛� [Paraformer-lagre妯″瀷](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx/summary) [CT-Transformer鏍囩偣棰勬祴妯″瀷](https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx/summary) diff --git a/funasr/runtime/docs/SDK_advanced_guide_offline_zh.md b/funasr/runtime/docs/SDK_advanced_guide_offline_zh.md index c5b4563..701515c 100644 --- a/funasr/runtime/docs/SDK_advanced_guide_offline_zh.md +++ b/funasr/runtime/docs/SDK_advanced_guide_offline_zh.md @@ -49,7 +49,7 @@ # 鎴栬�� damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx锛堢儹璇嶏級 ``` -鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔弬鏁颁粙缁峕(#鏈嶅姟绔弬鏁颁粙缁�) +鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔敤娉曡瑙(#鏈嶅姟绔敤娉曡瑙�) ### 瀹㈡埛绔祴璇曚笌浣跨敤 涓嬭浇瀹㈡埛绔祴璇曞伐鍏风洰褰晄amples @@ -150,14 +150,12 @@ ``` 璇︾粏鍙互鍙傝�冩枃妗o紙[鐐瑰嚮姝ゅ](../java/readme.md)锛� +## 鏈嶅姟绔敤娉曡瑙o細 - -## 鏈嶅姟绔弬鏁颁粙缁嶏細 - -funasr-wss-server鏀寔浠嶮odelscope涓嬭浇妯″瀷锛岃缃ā鍨嬩笅杞藉湴鍧�锛�--download-model-dir锛岄粯璁や负/workspace/models锛夊強model ID锛�--model-dir銆�--vad-dir銆�--punc-dir锛�,绀轰緥濡備笅锛� +### 鍚姩FunASR鏈嶅姟 ```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ +cd /workspace/FunASR/funasr/runtime +nohup bash run_server.sh \ --download-model-dir /workspace/models \ --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ @@ -167,9 +165,9 @@ --io-thread-num 8 \ --port 10095 \ --certfile ../../../ssl_key/server.crt \ - --keyfile ../../../ssl_key/server.key + --keyfile ../../../ssl_key/server.key > log.out 2>&1 & ``` -鍛戒护鍙傛暟浠嬬粛锛� +**run_server.sh鍛戒护鍙傛暟浠嬬粛** ```text --download-model-dir 妯″瀷涓嬭浇鍦板潃锛岄�氳繃璁剧疆model ID浠嶮odelscope涓嬭浇妯″瀷 --model-dir modelscope model ID @@ -182,38 +180,30 @@ --port 鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095 --decoder-thread-num 鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8 --io-thread-num 鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1 ---certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� ---keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� +--certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负0 +--keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key ``` -funasr-wss-server鍚屾椂涔熸敮鎸佷粠鏈湴璺緞鍔犺浇妯″瀷锛堟湰鍦版ā鍨嬭祫婧愬噯澶囪瑙乕妯″瀷璧勬簮鍑嗗](#妯″瀷璧勬簮鍑嗗)锛夌ず渚嬪涓嬶細 -```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server \ - --model-dir /workspace/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ - --vad-dir /workspace/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ - --punc-dir /workspace/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \ - --itn-dir /workspace/models/thuduj12/fst_itn_zh \ - --decoder-thread-num 32 \ - --io-thread-num 8 \ - --port 10095 \ - --certfile ../../../ssl_key/server.crt \ - --keyfile ../../../ssl_key/server.key - ``` -鍛戒护鍙傛暟浠嬬粛锛� +### 鍏抽棴FunASR鏈嶅姟 ```text ---model-dir ASR妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/asr ---quantize True涓洪噺鍖朅SR妯″瀷锛孎alse涓洪潪閲忓寲ASR妯″瀷锛岄粯璁ゆ槸True ---vad-dir VAD妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/vad ---vad-quant True涓洪噺鍖朧AD妯″瀷锛孎alse涓洪潪閲忓寲VAD妯″瀷锛岄粯璁ゆ槸True ---punc-dir PUNC妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/punc ---punc-quant True涓洪噺鍖朠UNC妯″瀷锛孎alse涓洪潪閲忓寲PUNC妯″瀷锛岄粯璁ゆ槸True ---itn-dir modelscope model ID ---port 鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095 ---decoder-thread-num 鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8 ---io-thread-num 鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1 ---certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� ---keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负鈥濃�� +# 鏌ョ湅 funasr-wss-server 瀵瑰簲鐨凱ID +ps -x | grep funasr-wss-server +kill -9 PID +``` + +### 淇敼妯″瀷鍙婂叾浠栧弬鏁� +鏇挎崲姝e湪浣跨敤鐨勬ā鍨嬫垨鑰呭叾浠栧弬鏁帮紝闇�鍏堝叧闂璅unASR鏈嶅姟锛屼慨鏀归渶瑕佹浛鎹㈢殑鍙傛暟锛屽苟閲嶆柊鍚姩FunASR鏈嶅姟銆傚叾涓ā鍨嬮渶涓篗odelScope涓殑ASR/VAD/PUNC妯″瀷锛屾垨鑰呬粠ModelScope涓ā鍨媐inetune鍚庣殑妯″瀷銆� +```text +# 渚嬪鏇挎崲ASR妯″瀷涓� damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx锛屽垯濡備笅璁剧疆鍙傛暟 --model-dir + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx +# 璁剧疆绔彛鍙� --port + --port <port number> +# 璁剧疆鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁� --decoder-thread-num + --decoder-thread-num <decoder thread num> +# 璁剧疆鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁� --io-thread-num + --io-thread-num <io thread num> +# 鍏抽棴SSL璇佷功 + --certfile 0 ``` 鎵ц涓婅堪鎸囦护鍚庯紝鍚姩绂荤嚎鏂囦欢杞啓鏈嶅姟銆傚鏋滄ā鍨嬫寚瀹氫负ModelScope涓璵odel id锛屼細鑷姩浠嶮oldeScope涓笅杞藉涓嬫ā鍨嬶細 diff --git a/funasr/runtime/docs/SDK_advanced_guide_online.md b/funasr/runtime/docs/SDK_advanced_guide_online.md index 4298bb8..d978c01 100644 --- a/funasr/runtime/docs/SDK_advanced_guide_online.md +++ b/funasr/runtime/docs/SDK_advanced_guide_online.md @@ -29,7 +29,7 @@ # If you want to close ssl锛宲lease add锛�--certfile 0 ``` -For a more detailed description of server parameters, please refer to [Server Introduction]() +For a more detailed description of server parameters, please refer to [Server Introduction](#Server Introduction) ### Client Testing and Usage Download the client testing tool directory `samples`: @@ -56,33 +56,69 @@ For more detailed usage, please click on the links above. For more client version support, please refer to [WebSocket/GRPC Protocol](./websocket_protocol_zh.md). -## Server Introduction: -funasr-wss-server-2pass supports downloading models from Modelscope or starting from a local directory path, as shown below: +## Server Introduction + +Use the flollowing script to start the server 锛� ```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server-2pass \ +cd /workspace/FunASR/funasr/runtime +nohup bash run_server_2pass.sh \ + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ + --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx \ + --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 \ --io-thread-num 8 \ - --port 10095 - ``` + --port 10095 \ + --certfile ../../../ssl_key/server.crt \ + --keyfile ../../../ssl_key/server.key > log.out 2>&1 & -Command parameter introduction: +# If you want to close ssl锛宲lease add锛�--certfile 0 +# If you want to deploy the timestamp or hotword model, please set --model-dir to the corresponding model: +# speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx锛坱imestamp锛� +# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx锛坔otword锛� + +``` + +### More details about the script run_server_2pass.sh: ```text ---download-model-dir Model download address, download models from Modelscope by setting model id ---model-dir modelscope model ID +--download-model-dir: Model download address, download models from Modelscope by setting the model ID. +--model-dir: Modelscope model ID. --online-model-dir modelscope model ID ---quantize True for quantized ASR models, False for non-quantized ASR models, default is True ---vad-dir modelscope model ID ---vad-quant True for quantized VAD models, False for non-quantized VAD models, default is True ---punc-dir modelscope model ID ---punc-quant True for quantized PUNC models, False for non-quantized PUNC models, default is True +--quantize: True for quantized ASR model, False for non-quantized ASR model. Default is True. +--vad-dir: Modelscope model ID. +--vad-quant: True for quantized VAD model, False for non-quantized VAD model. Default is True. +--punc-dir: Modelscope model ID. +--punc-quant: True for quantized PUNC model, False for non-quantized PUNC model. Default is True. --itn-dir modelscope model ID ---port Port number that the server should listen on, default is 10095 ---decoder-thread-num The number of inference threads the server should start, default is 8 ---io-thread-num The number of IO threads the server should start, default is 1 ---certfile SSL certificate file, the default is: ../../../ssl_key/server.crt, set to "" to disable ---keyfile SSL key file, the default is: ../../../ssl_key/server.key, set to "" to disable +--port: Port number that the server listens on. Default is 10095. +--decoder-thread-num: Number of inference threads that the server starts. Default is 8. +--io-thread-num: Number of IO threads that the server starts. Default is 1. +--certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close ssl锛宻et 0 +--keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. +``` + +### Shutting Down the FunASR Service +```text +# Check the PID of the funasr-wss-server-2pass process +ps -x | grep funasr-wss-server-2pass +kill -9 PID +``` + +### Modifying Models and Other Parameters +To replace the currently used model or other parameters, you need to first shut down the FunASR service, make the necessary modifications to the parameters you want to replace, and then restart the FunASR service. The model should be either an ASR/VAD/PUNC model from ModelScope or a fine-tuned model obtained from ModelScope. +```text +# For example, to replace the ASR model with damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx, use the following parameter setting --model-dir + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx +# Set the port number using --port + --port <port number> +# Set the number of inference threads the server will start using --decoder-thread-num + --decoder-thread-num <decoder thread num> +# Set the number of IO threads the server will start using --io-thread-num + --io-thread-num <io thread num> +# Disable SSL certificate + --certfile 0 ``` After executing the above command, the real-time speech transcription service will be started. If the model is specified as a ModelScope model id, the following models will be automatically downloaded from ModelScope: diff --git a/funasr/runtime/docs/SDK_advanced_guide_online_zh.md b/funasr/runtime/docs/SDK_advanced_guide_online_zh.md index bb68371..a83f760 100644 --- a/funasr/runtime/docs/SDK_advanced_guide_online_zh.md +++ b/funasr/runtime/docs/SDK_advanced_guide_online_zh.md @@ -38,7 +38,7 @@ # damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx锛堟椂闂存埑锛� # 鎴栬�� damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx锛堢儹璇嶏級 ``` -鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔弬鏁颁粙缁峕(#鏈嶅姟绔弬鏁颁粙缁�) +鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔敤娉曡瑙(#鏈嶅姟绔敤娉曡瑙�) ### 瀹㈡埛绔祴璇曚笌浣跨敤 涓嬭浇瀹㈡埛绔祴璇曞伐鍏风洰褰晄amples @@ -65,18 +65,24 @@ 璇︾粏鐢ㄦ硶鍙互鐐瑰嚮杩涘叆鏌ョ湅銆傛洿澶氱増鏈鎴风鏀寔璇峰弬鑰僛websocket/grpc鍗忚](./websocket_protocol_zh.md) -## 鏈嶅姟绔弬鏁颁粙缁嶏細 +## 鏈嶅姟绔敤娉曡瑙o細 -funasr-wss-server-2pass鏀寔浠嶮odelscope涓嬭浇妯″瀷锛屾垨鑰呬粠鏈湴鐩綍璺緞鍚姩锛岀ず渚嬪涓嬶細 +### 鍚姩FunASR鏈嶅姟 ```shell -cd /workspace/FunASR/funasr/runtime/websocket/build/bin -./funasr-wss-server-2pass \ +cd /workspace/FunASR/funasr/runtime +nohup bash run_server_2pass.sh \ + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ + --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx \ + --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 \ --io-thread-num 8 \ - --port 10095 + --port 10095 \ + --certfile ../../../ssl_key/server.crt \ + --keyfile ../../../ssl_key/server.key > log.out 2>&1 & ``` - -鍛戒护鍙傛暟浠嬬粛锛� +**run_server_2pass.sh鍛戒护鍙傛暟浠嬬粛** ```text --download-model-dir 妯″瀷涓嬭浇鍦板潃锛岄�氳繃璁剧疆model ID浠嶮odelscope涓嬭浇妯″瀷 --model-dir modelscope model ID @@ -90,8 +96,30 @@ --port 鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095 --decoder-thread-num 鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8 --io-thread-num 鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1 ---certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽闇�鍏抽棴锛岃缃负"" ---keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key锛屽闇�鍏抽棴锛岃缃负"" +--certfile ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt锛屽鏋滈渶瑕佸叧闂璼sl锛屽弬鏁拌缃负0 +--keyfile ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key +``` + +### 鍏抽棴FunASR鏈嶅姟 +```text +# 鏌ョ湅 funasr-wss-server-2pass 瀵瑰簲鐨凱ID +ps -x | grep funasr-wss-server-2pass +kill -9 PID +``` + +### 淇敼妯″瀷鍙婂叾浠栧弬鏁� +鏇挎崲姝e湪浣跨敤鐨勬ā鍨嬫垨鑰呭叾浠栧弬鏁帮紝闇�鍏堝叧闂璅unASR鏈嶅姟锛屼慨鏀归渶瑕佹浛鎹㈢殑鍙傛暟锛屽苟閲嶆柊鍚姩FunASR鏈嶅姟銆傚叾涓ā鍨嬮渶涓篗odelScope涓殑ASR/VAD/PUNC妯″瀷锛屾垨鑰呬粠ModelScope涓ā鍨媐inetune鍚庣殑妯″瀷銆� +```text +# 渚嬪鏇挎崲ASR妯″瀷涓� damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx锛屽垯濡備笅璁剧疆鍙傛暟 --model-dir + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx +# 璁剧疆绔彛鍙� --port + --port <port number> +# 璁剧疆鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁� --decoder-thread-num + --decoder-thread-num <decoder thread num> +# 璁剧疆鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁� --io-thread-num + --io-thread-num <io thread num> +# 鍏抽棴SSL璇佷功 + --certfile 0 ``` 鎵ц涓婅堪鎸囦护鍚庯紝鍚姩瀹炴椂璇煶鍚啓鏈嶅姟銆傚鏋滄ā鍨嬫寚瀹氫负ModelScope涓璵odel id锛屼細鑷姩浠嶮oldeScope涓笅杞藉涓嬫ā鍨嬶細 -- Gitblit v1.9.1