update docs for server instructions

This commit is contained in:
lyblsgo 2023-10-11 19:47:18 +08:00
parent e899096ce4
commit bd9ed05411
6 changed files with 208 additions and 147 deletions

View File

@ -49,7 +49,6 @@ Introduction to command parameters:
```
## Starting the server
Use the flollowing script to start the server
@ -65,15 +64,16 @@ nohup bash run_server.sh \
# 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-onnxtimestamp
# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnxhotword
```
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 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
--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 @@ Introduction to command parameters:
--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 sslset ""
--keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. If you want to close sslset ""
--certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close sslset 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)

View File

@ -64,13 +64,13 @@ nohup bash run_server.sh \
```
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 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
--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 @@ Introduction to command parameters:
--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 sslset ""
--keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. If you want to close sslset ""
--certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close sslset 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)

View File

@ -45,7 +45,7 @@ nohup bash run_server.sh \
# 如果您想关闭ssl增加参数--certfile 0
```
服务端详细参数介绍可参考[服务端参数介绍](#服务端参数介绍)
服务端详细参数介绍可参考[服务端用法详解](#服务端用法详解)
### 客户端测试与使用
下载客户端测试工具目录samples
@ -148,12 +148,12 @@ FunasrWsClient --host localhost --port 10095 --audio_in ./asr_example.wav --mode
## 服务端参数介绍
## 服务端用法详解
funasr-wss-server支持从Modelscope下载模型设置模型下载地址--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 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
--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从Modelscope下载模型
--model-dir modelscope model ID
@ -177,40 +177,34 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
--port 服务端监听的端口号,默认为 10095
--decoder-thread-num 服务端启动的推理线程数,默认为 8
--io-thread-num 服务端启动的IO线程数默认为 1
--certfile ssl的证书文件默认为../../../ssl_key/server.crt如果需要关闭ssl参数设置为”“
--keyfile ssl的密钥文件默认为../../../ssl_key/server.key如果需要关闭ssl参数设置为”“
--certfile ssl的证书文件默认为../../../ssl_key/server.crt如果需要关闭ssl参数设置为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为量化ASR模型False为非量化ASR模型默认是True
--vad-dir VAD模型路径默认为/workspace/models/vad
--vad-quant True为量化VAD模型False为非量化VAD模型默认是True
--punc-dir PUNC模型路径默认为/workspace/models/punc
--punc-quant True为量化PUNC模型False为非量化PUNC模型默认是True
--itn-dir modelscope model ID
--port 服务端监听的端口号,默认为 10095
--decoder-thread-num 服务端启动的推理线程数,默认为 8
--io-thread-num 服务端启动的IO线程数默认为 1
--certfile ssl的证书文件默认为../../../ssl_key/server.crt如果需要关闭ssl参数设置为”“
--keyfile ssl的密钥文件默认为../../../ssl_key/server.key如果需要关闭ssl参数设置为”“
# 查看 funasr-wss-server 对应的PID
ps -x | grep funasr-wss-server
kill -9 PID
```
执行上述指令后启动离线文件转写服务。如果模型指定为ModelScope中model id会自动从MoldeScope中下载如下模型
### 修改模型及其他参数
替换正在使用的模型或者其他参数需先关闭FunASR服务修改需要替换的参数并重新启动FunASR服务。其中模型需为ModelScope中的ASR/VAD/PUNC模型或者从ModelScope中模型finetune后的模型。
```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中model id会自动从MoldeScope中下载如下模型
[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)

View File

@ -49,7 +49,7 @@ nohup bash run_server.sh \
# 或者 damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx热词
```
服务端详细参数介绍可参考[服务端参数介绍](#服务端参数介绍)
服务端详细参数介绍可参考[服务端用法详解](#服务端用法详解)
### 客户端测试与使用
下载客户端测试工具目录samples
@ -150,14 +150,12 @@ FunasrWsClient --host localhost --port 10095 --audio_in ./asr_example.wav --mode
```
详细可以参考文档([点击此处](../java/readme.md)
## 服务端用法详解:
## 服务端参数介绍:
funasr-wss-server支持从Modelscope下载模型设置模型下载地址--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 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
--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从Modelscope下载模型
--model-dir modelscope model ID
@ -182,38 +180,30 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
--port 服务端监听的端口号,默认为 10095
--decoder-thread-num 服务端启动的推理线程数,默认为 8
--io-thread-num 服务端启动的IO线程数默认为 1
--certfile ssl的证书文件默认为../../../ssl_key/server.crt如果需要关闭ssl参数设置为”“
--keyfile ssl的密钥文件默认为../../../ssl_key/server.key如果需要关闭ssl参数设置为”“
--certfile ssl的证书文件默认为../../../ssl_key/server.crt如果需要关闭ssl参数设置为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为量化ASR模型False为非量化ASR模型默认是True
--vad-dir VAD模型路径默认为/workspace/models/vad
--vad-quant True为量化VAD模型False为非量化VAD模型默认是True
--punc-dir PUNC模型路径默认为/workspace/models/punc
--punc-quant True为量化PUNC模型False为非量化PUNC模型默认是True
--itn-dir modelscope model ID
--port 服务端监听的端口号,默认为 10095
--decoder-thread-num 服务端启动的推理线程数,默认为 8
--io-thread-num 服务端启动的IO线程数默认为 1
--certfile ssl的证书文件默认为../../../ssl_key/server.crt如果需要关闭ssl参数设置为”“
--keyfile ssl的密钥文件默认为../../../ssl_key/server.key如果需要关闭ssl参数设置为”“
# 查看 funasr-wss-server 对应的PID
ps -x | grep funasr-wss-server
kill -9 PID
```
### 修改模型及其他参数
替换正在使用的模型或者其他参数需先关闭FunASR服务修改需要替换的参数并重新启动FunASR服务。其中模型需为ModelScope中的ASR/VAD/PUNC模型或者从ModelScope中模型finetune后的模型。
```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中model id会自动从MoldeScope中下载如下模型

View File

@ -29,7 +29,7 @@ nohup bash run_server_2pass.sh \
# If you want to close sslplease 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 @@ After completing the FunASR service deployment on the server, you can test and u
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 sslplease 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-onnxtimestamp
# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnxhotword
```
### 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 sslset 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:

View File

@ -38,7 +38,7 @@ nohup bash run_server_2pass.sh \
# 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热词
```
服务端详细参数介绍可参考[服务端参数介绍](#服务端参数介绍)
服务端详细参数介绍可参考[服务端用法详解](#服务端用法详解)
### 客户端测试与使用
下载客户端测试工具目录samples
@ -65,18 +65,24 @@ python3 wss_client_asr.py --host "127.0.0.1" --port 10095 --mode 2pass
详细用法可以点击进入查看。更多版本客户端支持请参考[websocket/grpc协议](./websocket_protocol_zh.md)
## 服务端参数介绍
## 服务端用法详解
funasr-wss-server-2pass支持从Modelscope下载模型或者从本地目录路径启动示例如下
### 启动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从Modelscope下载模型
--model-dir modelscope model ID
@ -90,8 +96,30 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
--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如果需要关闭ssl参数设置为0
--keyfile ssl的密钥文件默认为../../../ssl_key/server.key
```
### 关闭FunASR服务
```text
# 查看 funasr-wss-server-2pass 对应的PID
ps -x | grep funasr-wss-server-2pass
kill -9 PID
```
### 修改模型及其他参数
替换正在使用的模型或者其他参数需先关闭FunASR服务修改需要替换的参数并重新启动FunASR服务。其中模型需为ModelScope中的ASR/VAD/PUNC模型或者从ModelScope中模型finetune后的模型。
```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中model id会自动从MoldeScope中下载如下模型