From 743b9fbc35e1dbb1aa0c627b8bb7953098cbfee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=B8=E9=9B=81?= Date: Thu, 9 Nov 2023 18:47:07 +0800 Subject: [PATCH] docs --- README.md | 2 +- funasr/quick_start_zh.md | 90 ++++++++++++++++--- runtime/docs/SDK_advanced_guide_offline_zh.md | 2 +- 3 files changed, 81 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3f6b4349e..f73c0ca92 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ FunASR has open-sourced a large number of pre-trained models on industrial data. |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------:|:--------------------------------:|:----------:| | paraformer-zh ([⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) [🤗]() ) | speech recognition, with timestamps, non-streaming | 60000 hours, Mandarin | 220M | | paraformer-zh-spk ( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/summary) [🤗]() ) | speech recognition with speaker diarization, with timestamps, non-streaming | 60000 hours, Mandarin | 220M | -| paraformer-zh-online ( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗]() ) | speech recognition, non-streaming | 60000 hours, Mandarin | 220M | +| paraformer-zh-online ( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗]() ) | speech recognition, streaming | 60000 hours, Mandarin | 220M | | paraformer-en ( [⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) [🤗]() ) | speech recognition, with timestamps, non-streaming | 50000 hours, English | 220M | | paraformer-en-spk ([🤗]() [⭐]() ) | speech recognition with speaker diarization, non-streaming | 50000 hours, English | 220M | | conformer-en ( [⭐](https://modelscope.cn/models/damo/speech_conformer_asr-en-16k-vocab4199-pytorch/summary) [🤗]() ) | speech recognition, non-streaming | 50000 hours, English | 220M | diff --git a/funasr/quick_start_zh.md b/funasr/quick_start_zh.md index 9a3c2c94f..94ec434f5 100644 --- a/funasr/quick_start_zh.md +++ b/funasr/quick_start_zh.md @@ -5,11 +5,11 @@ 您可以通过如下几种方式使用FunASR功能: -- 服务部署SDK +- 服务部署社区软件包 - 工业模型egs - 学术模型egs -### 服务部署SDK +### 服务部署社区软件包 #### python版本示例 @@ -31,13 +31,49 @@ python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass --chunk #### c++版本示例 -集成有,VAD,ASR与标点恢复模型,支持上百路并发请求 +既可以进行高精度、高效率与高并发的文件转写,也可以进行低延时的实时语音听写。支持Docker化部署,多路请求。 + +##### 准备工作:docker安装(可选) +###### 如果您已安装docker,忽略本步骤 + +```shell +curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh; +sudo bash install_docker.sh +``` ##### 实时语音听写服务部署 +###### docker镜像下载与启动 +通过下述命令拉取并启动FunASR软件包docker镜像([获取最新镜像版本](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online_zh.md)): + ```shell -curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy-online-cpu-zh.sh -sudo bash funasr-runtime-deploy-online-cpu-zh.sh install --workspace ./funasr-runtime-resources +sudo docker pull \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.5 +mkdir -p ./funasr-runtime-resources/models +sudo docker run -p 10096:10095 -it --privileged=true \ + -v $PWD/funasr-runtime-resources/models:/workspace/models \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.5 +``` + +###### 服务端启动 +docker启动之后,启动 funasr-wss-server-2pass服务程序: +```shell +cd FunASR/runtime +nohup bash run_server_2pass.sh \ + --download-model-dir /workspace/models \ + --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ + --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 \ + --punc-dir damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx \ + --itn-dir thuduj12/fst_itn_zh \ + --hotword /workspace/models/hotwords.txt > log.out 2>&1 & + +# 如果您想关闭ssl,增加参数:--certfile 0 +# 如果您想使用时间戳或者nn热词模型进行部署,请设置--model-dir为对应模型: +# 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(nn热词) +# 如果您想在服务端加载热词,请在宿主机文件./funasr-runtime-resources/models/hotwords.txt配置热词(docker映射地址为/workspace/models/hotwords.txt): +# 每行一个热词,格式(热词 权重):阿里巴巴 20 ``` ##### 客户端测试与使用 @@ -46,20 +82,52 @@ sudo bash funasr-runtime-deploy-online-cpu-zh.sh install --workspace ./funasr-ru ```shell python3 funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass ``` -更多例子参考([点击此处](../runtime/docs/SDK_tutorial_online_zh.md)) +更多例子参考([点击此处](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_online_zh.md)) ##### 离线文件转写服务部署 -###### 服务端部署 + +###### 镜像启动 + +通过下述命令拉取并启动FunASR软件包docker镜像([获取最新镜像版本](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline_zh.md)): + ```shell -curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy-offline-cpu-zh.sh -sudo bash funasr-runtime-deploy-offline-cpu-zh.sh install --workspace ./funasr-runtime-resources +sudo docker pull \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.3.0 +mkdir -p ./funasr-runtime-resources/models +sudo docker run -p 10095:10095 -it --privileged=true \ + -v $PWD/funasr-runtime-resources/models:/workspace/models \ + registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.3.0 ``` + + +###### 服务端启动 + +docker启动之后,启动 funasr-wss-server服务程序: +```shell +cd FunASR/runtime +nohup bash run_server.sh \ + --download-model-dir /workspace/models \ + --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ + --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \ + --punc-dir damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx \ + --lm-dir damo/speech_ngram_lm_zh-cn-ai-wesp-fst \ + --itn-dir thuduj12/fst_itn_zh \ + --hotword /workspace/models/hotwords.txt > log.out 2>&1 & + +# 如果您想关闭ssl,增加参数:--certfile 0 +# 如果您想使用时间戳或者nn热词模型进行部署,请设置--model-dir为对应模型: +# 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(nn热词) +# 如果您想在服务端加载热词,请在宿主机文件./funasr-runtime-resources/models/hotwords.txt配置热词(docker映射地址为/workspace/models/hotwords.txt): +# 每行一个热词,格式(热词 权重):阿里巴巴 20 +``` + ###### 客户端测试 客户端测试([samples](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz)) ```shell python3 funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav" ``` -更多例子参考([点击此处](../runtime/docs/SDK_tutorial_zh.md)) +更多例子参考([点击此处](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline_zh.md)) @@ -74,7 +142,7 @@ from modelscope.utils.constant import Tasks inference_pipeline = pipeline( task=Tasks.auto_speech_recognition, - model='damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch', + model='damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch', ) rec_result = inference_pipeline(audio_in='https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav') diff --git a/runtime/docs/SDK_advanced_guide_offline_zh.md b/runtime/docs/SDK_advanced_guide_offline_zh.md index 4bf1cd1d8..03cf8e7a5 100644 --- a/runtime/docs/SDK_advanced_guide_offline_zh.md +++ b/runtime/docs/SDK_advanced_guide_offline_zh.md @@ -38,7 +38,7 @@ docker安装失败请参考 [Docker Installation](https://alibaba-damo-academy.g ### 镜像启动 -通过下述命令拉取并启动FunASR runtime-SDK的docker镜像: +通过下述命令拉取并启动FunASR软件包的docker镜像: ```shell sudo docker pull \