Browse Source

update docs

雾聪 2 years ago
parent
commit
799249154b

+ 6 - 60
funasr/runtime/docs/SDK_advanced_guide_offline.md

@@ -116,59 +116,14 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
   --keyfile ../../../ssl_key/server.key
  ```
 
+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)
+[Paraformer-lagre](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx/summary)
+[CT-Transformer](https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx/summary)
 
-## Preparing Model Resources
+If you wish to deploy your fine-tuned model (e.g., 10epoch.pb), you need to manually rename the model to model.pb and replace the original model.pb in ModelScope. Then, specify the path as `model_dir`.
 
-If you choose to download models from Modelscope through the FunASR-wss-server, you can skip this step. The vad, asr, and punc model resources in the offline file transcription service of FunASR are all from Modelscope. The model addresses are shown in the table below:
 
-| Model | Modelscope url                                                                                                   |
-|-------|------------------------------------------------------------------------------------------------------------------|
-| VAD   | https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary |
-| ASR   | https://www.modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary                           |
-| PUNC  | https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/summary               |
-
-The offline file transcription service deploys quantized ONNX models. Below are instructions on how to export ONNX models and their quantization. You can choose to export ONNX models from Modelscope, local files, or finetuned resources: 
-
-### Exporting ONNX models from Modelscope
-
-Download the corresponding model with the given model name from the Modelscope website, and then export the quantized ONNX model
-
-```shell
-python -m funasr.export.export_model \
---export-dir ./export \
---type onnx \
---quantize True \
---model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch \
---model-name damo/speech_fsmn_vad_zh-cn-16k-common-pytorch \
---model-name damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch
-```
-
-Introduction to command parameters:
-
-```text
---model-name: The name of the model on Modelscope, for example: damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
---export-dir: The export directory of ONNX model.
---type: Model type, currently supports ONNX and torch.
---quantize: Quantize the int8 model.
-```
-
-### Exporting ONNX models from local files
-
-Set the model name to the local path of the model, and export the quantized ONNX model:
-
-```shell
-python -m funasr.export.export_model --model-name /workspace/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type onnx --quantize True
-```
-
-
-### Exporting models from finetuned resources
-
-If you want to deploy a finetuned model, you can follow these steps:
-Rename the model you want to deploy after finetuning (for example, 10epoch.pb) to model.pb, and replace the original model.pb in Modelscope with this one. If the path of the replaced model is /path/to/finetune/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch, use the following command to convert the finetuned model to an ONNX model: 
-
-```shell
-python -m funasr.export.export_model --model-name /path/to/finetune/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type onnx --quantize True
-```
 
 ## Starting the client
 
@@ -210,16 +165,7 @@ Introduction to command parameters:
 
 ### Custom client
 
-If you want to define your own client, the Websocket communication protocol is as follows:
-
-```text
-# First communication
-{"mode": "offline", "wav_name": wav_name, "is_speaking": True, "hotwords": "hotword1|hotword2"}
-# Send wav data
-Bytes data
-# Send end flag
-{"is_speaking": False}
-```
+If you want to define your own client, see the [Websocket communication protocol](./websocket_protocol.md)
 
 ## How to customize service deployment
 

+ 7 - 52
funasr/runtime/docs/SDK_advanced_guide_offline_zh.md

@@ -191,51 +191,12 @@ cd /workspace/FunASR/funasr/runtime/websocket/build/bin
 --keyfile  ssl的密钥文件,默认为:../../../ssl_key/server.key,如果需要关闭ssl,参数设置为”“
 ```
 
-## 模型资源准备
-
-如果您选择通过funasr-wss-server从Modelscope下载模型,可以跳过本步骤。
-
-FunASR离线文件转写服务中的vad、asr和punc模型资源均来自Modelscope,模型地址详见下表:
-
-| 模型 | Modelscope链接                                                                                                  |
-|------|---------------------------------------------------------------------------------------------------------------|
-| VAD  | https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx/summary |
-| ASR  | https://www.modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx/summary                           |
-| PUNC | https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx/summary               |
-
-离线文件转写服务中部署的是量化后的ONNX模型,下面介绍下如何导出ONNX模型及其量化:您可以选择从Modelscope导出ONNX模型、从finetune后的资源导出模型:
-
-### 从Modelscope导出ONNX模型
-
-从Modelscope网站下载对应model name的模型,然后导出量化后的ONNX模型:
-
-```shell
-python -m funasr.export.export_model \
---export-dir ./export \
---type onnx \
---quantize True \
---model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch \
---model-name damo/speech_fsmn_vad_zh-cn-16k-common-pytorch \
---model-name damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch
-```
-
-命令参数介绍:
-```text
---model-name  Modelscope上的模型名称,例如damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
---export-dir  ONNX模型导出地址
---type 模型类型,目前支持 ONNX、torch
---quantize  int8模型量化
-```
-### 从finetune后的资源导出模型
-
-假如您想部署finetune后的模型,可以参考如下步骤:
-
-将您finetune后需要部署的模型(例如10epoch.pb),重命名为model.pb,并将原modelscope中模型model.pb替换掉,假如替换后的模型路径为/path/to/finetune/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch,通过下述命令把finetune后的模型转成onnx模型:
-
-```shell
-python -m funasr.export.export_model --model-name /path/to/finetune/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type onnx --quantize True
-```
+执行上述指令后,启动离线文件转写服务。如果模型指定为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-zh-cn-16k-common-vocab8404-onnx/summary)
+[CT-Transformer标点预测模型](https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx/summary)
 
+如果,您希望部署您finetune后的模型(例如10epoch.pb),需要手动将模型重命名为model.pb,并将原modelscope中模型model.pb替换掉,将路径指定为`model_dir`即可。
 
 
 ## 如何定制服务部署
@@ -251,15 +212,9 @@ https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/python/w
 
 ### 自定义客户端:
 
-如果您想定义自己的client,websocket通信协议为:
+如果您想定义自己的client,参考[websocket通信协议](./websocket_protocol_zh.md)
+
 
-```text
-# 首次通信
-{"mode": "offline", "wav_name": wav_name, "is_speaking": True}
-# 发送wav数据
-bytes数据
-# 发送结束标志
-{"is_speaking": False}
 ```
 
 ### c++ 服务端:

+ 2 - 2
funasr/runtime/docs/SDK_tutorial_online.md

@@ -24,9 +24,9 @@ Cloud service providers offer a 3-month free trial for new users. Application tu
 Download the deployment tool `funasr-runtime-deploy-online-cpu-zh.sh`
 
 ```shell
-curl -O https://raw.githubusercontent.com/alibaba-damo-academy/FunASR/main/funasr/runtime/deploy_tools/funasr-runtime-deploy-online-cpu-en.sh;
+curl -O https://raw.githubusercontent.com/alibaba-damo-academy/FunASR/main/funasr/runtime/deploy_tools/funasr-runtime-deploy-online-cpu-zh.sh;
 # If there is a network problem, users in mainland China can use the following command:
-# curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy-online-cpu-en.sh;
+# curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy-online-cpu-zh.sh;
 ```
 
 Execute the deployment tool and press the Enter key at the prompt to complete the installation and deployment of the server. Currently, the convenient deployment tool only supports Linux environments. For other environments, please refer to the development guide ([docs](./SDK_advanced_guide_online.md)).