| | |
| | | # 如果您想关闭ssl,增加参数:--certfile 0 |
| | | |
| | | ``` |
| | | 服务端详细参数介绍可参考[服务端参数介绍](#服务端参数介绍) |
| | | 服务端详细参数介绍可参考[服务端用法详解](#服务端用法详解) |
| | | ### 客户端测试与使用 |
| | | |
| | | 下载客户端测试工具目录samples |
| | |
| | | |
| | | |
| | | |
| | | ## 服务端参数介绍: |
| | | ## 服务端用法详解: |
| | | |
| | | 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 \ |
| | |
| | | --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 |
| | |
| | | --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) |