From 22e549a7b11a55dce3cb7ba265d61ac999070f88 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 08 十一月 2023 16:32:39 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR add
---
runtime/docs/SDK_advanced_guide_online.md | 19 +++-
runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py | 8 +
runtime/docs/SDK_advanced_guide_online_zh.md | 20 ++--
runtime/docs/SDK_advanced_guide_offline_en.md | 40 +--------
runtime/docs/SDK_advanced_guide_offline_zh.md | 41 +---------
runtime/docs/SDK_advanced_guide_offline.md | 52 ++----------
runtime/docs/SDK_advanced_guide_offline_en_zh.md | 39 ---------
runtime/docs/images/offline_structure.jpg | 0
8 files changed, 53 insertions(+), 166 deletions(-)
diff --git a/runtime/docs/SDK_advanced_guide_offline.md b/runtime/docs/SDK_advanced_guide_offline.md
index 1ce9472..ad75ca0 100644
--- a/runtime/docs/SDK_advanced_guide_offline.md
+++ b/runtime/docs/SDK_advanced_guide_offline.md
@@ -4,37 +4,19 @@
This document serves as a development guide for the FunASR offline file transcription service. If you wish to quickly experience the offline file transcription service, please refer to the one-click deployment example for the FunASR offline file transcription service ([docs](./SDK_tutorial.md)).
-## Installation of Docker
+<img src="images/offline_structure.jpg" width="900"/>
-The following steps are for manually installing Docker and Docker images. If your Docker image has already been launched, you can ignore this step.
-
-### Installation of Docker environment
-
+## Quick start
+### Docker install
+If you have already installed Docker, ignore this step!
```shell
-# Ubuntu锛�
-curl -fsSL https://test.docker.com -o test-docker.sh
-sudo sh test-docker.sh
-# Debian锛�
-curl -fsSL https://get.docker.com -o get-docker.sh
-sudo sh get-docker.sh
-# CentOS锛�
-curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
-# MacOS锛�
-brew install --cask --appdir=/Applications docker
+curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh;
+sudo bash install_docker.sh
```
-
-More details could ref to [docs](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
-
-### Starting Docker
-
-```shell
-sudo systemctl start docker
-```
+If you do not have Docker installed, please refer to [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
### Pulling and launching images
-
Use the following command to pull and launch the Docker image for the FunASR runtime-SDK:
-
```shell
sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.3.0
@@ -46,11 +28,9 @@
-p <host port>:<mapped docker port>: In the example, host machine (ECS) port 10095 is mapped to port 10095 in the Docker container. Make sure that port 10095 is open in the ECS security rules.
-v <host path>:<mounted Docker path>: In the example, the host machine path /root is mounted to the Docker path /workspace/models.
-
```
-## Starting the server
-
+### Starting the server
Use the flollowing script to start the server 锛�
```shell
nohup bash run_server.sh \
@@ -59,7 +39,8 @@
--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 > log.out 2>&1 &
+ --itn-dir thuduj12/fst_itn_zh \
+ --hotword /workspace/models/hotwords.txt > log.out 2>&1 &
# If you want to close ssl锛宲lease add锛�--certfile 0
# If you want to deploy the timestamp or nn hotword model, please set --model-dir to the corresponding model:
@@ -67,7 +48,6 @@
# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx锛坔otword锛�
# If you want to load hotwords on the server side, please configure the hotwords in the host machine file ./funasr-runtime-resources/models/hotwords.txt (docker mapping address: /workspace/models/hotwords.txt):
# One hotword per line, format (hotword weight): 闃块噷宸村反 20"
-
```
### More details about the script run_server.sh:
@@ -92,7 +72,6 @@
```
Introduction to run_server.sh parameters:
-
```text
--download-model-dir: Model download address, download models from Modelscope by setting the model ID.
--model-dir: Modelscope model ID.
@@ -141,19 +120,14 @@
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`.
-
-
## Starting the client
-
After completing the deployment of FunASR offline file transcription service on the server, you can test and use the service by following these steps. Currently, FunASR-bin supports multiple ways to start the client. The following are command-line examples based on python-client, c++-client, and custom client Websocket communication protocol:
### python-client
```shell
python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "./data/wav.scp" --send_without_sleep --output_dir "./results"
```
-
Introduction to command parameters:
-
```text
--host: the IP address of the server. It can be set to 127.0.0.1 for local testing.
--port: the port number of the server listener.
@@ -171,7 +145,6 @@
```
Introduction to command parameters:
-
```text
--server-ip: the IP address of the server. It can be set to 127.0.0.1 for local testing.
--port: the port number of the server listener.
@@ -182,19 +155,15 @@
```
### Custom client
-
If you want to define your own client, see the [Websocket communication protocol](./websocket_protocol.md)
## How to customize service deployment
-
The code for FunASR-runtime is open source. If the server and client cannot fully meet your needs, you can further develop them based on your own requirements:
### C++ client
-
https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/websocket
### Python client
-
https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/websocket
### C++ server
@@ -218,7 +187,6 @@
FUNASR_RESULT result=FunOfflineInfer(asr_hanlde, wav_file.c_str(), RASR_NONE, NULL, 16000);
// Where: asr_hanlde is the return value of FunOfflineInit, wav_file is the path to the audio file, and sampling_rate is the sampling rate (default 16k).
```
-
See the usage example for details, [docs](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/onnxruntime/bin/funasr-onnx-offline.cpp)
#### PUNC
diff --git a/runtime/docs/SDK_advanced_guide_offline_en.md b/runtime/docs/SDK_advanced_guide_offline_en.md
index 6d4bf9c..42bc52d 100644
--- a/runtime/docs/SDK_advanced_guide_offline_en.md
+++ b/runtime/docs/SDK_advanced_guide_offline_en.md
@@ -4,43 +4,22 @@
This document serves as a development guide for the FunASR offline file transcription service. If you wish to quickly experience the offline file transcription service, please refer to the one-click deployment example for the FunASR offline file transcription service ([docs](./SDK_tutorial.md)).
-## Installation of Docker
-
-The following steps are for manually installing Docker and Docker images. If your Docker image has already been launched, you can ignore this step.
-
-### Installation of Docker environment
-
+## Quick start
+### Docker install
+If you have already installed Docker, ignore this step!
```shell
-# Ubuntu锛�
-curl -fsSL https://test.docker.com -o test-docker.sh
-sudo sh test-docker.sh
-# Debian锛�
-curl -fsSL https://get.docker.com -o get-docker.sh
-sudo sh get-docker.sh
-# CentOS锛�
-curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
-# MacOS锛�
-brew install --cask --appdir=/Applications docker
+curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh;
+sudo bash install_docker.sh
```
-
-More details could ref to [docs](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
-
-### Starting Docker
-
-```shell
-sudo systemctl start docker
-```
+If you do not have Docker installed, please refer to [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
### Pulling and launching images
-
Use the following command to pull and launch the Docker image for the FunASR runtime-SDK:
-
```shell
sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.1
sudo docker run -p 10097:10095 -it --privileged=true -v /root:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.1
```
-
Introduction to command parameters:
```text
-p <host port>:<mapped docker port>: In the example, host machine (ECS) port 10097 is mapped to port 10095 in the Docker container. Make sure that port 10097 is open in the ECS security rules.
@@ -49,9 +28,7 @@
```
-
-## Starting the server
-
+### Starting the server
Use the flollowing script to start the server 锛�
```shell
nohup bash run_server.sh \
@@ -61,11 +38,9 @@
--punc-dir damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx > log.out 2>&1 &
# If you want to close ssl锛宲lease add锛�--certfile 0
-
```
### 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:
```shell
@@ -83,7 +58,6 @@
```
Introduction to run_server.sh parameters:
-
```text
--download-model-dir: Model download address, download models from Modelscope by setting the model ID.
--model-dir: Modelscope model ID.
diff --git a/runtime/docs/SDK_advanced_guide_offline_en_zh.md b/runtime/docs/SDK_advanced_guide_offline_en_zh.md
index 11f565a..769ab95 100644
--- a/runtime/docs/SDK_advanced_guide_offline_en_zh.md
+++ b/runtime/docs/SDK_advanced_guide_offline_en_zh.md
@@ -17,7 +17,6 @@
## 蹇�熶笂鎵�
-
### docker瀹夎
濡傛灉鎮ㄥ凡瀹夎docker锛屽拷鐣ユ湰姝ラ锛�!
閫氳繃涓嬭堪鍛戒护鍦ㄦ湇鍔″櫒涓婂畨瑁卍ocker锛�
@@ -25,11 +24,10 @@
curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh锛�
sudo bash install_docker.sh
```
+docker瀹夎澶辫触璇峰弬鑰� [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
### 闀滃儚鍚姩
-
閫氳繃涓嬭堪鍛戒护鎷夊彇骞跺惎鍔‵unASR runtime-SDK鐨刣ocker闀滃儚锛�
-
```shell
sudo docker pull \
registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.1
@@ -38,7 +36,6 @@
-v $PWD/funasr-runtime-resources/models:/workspace/models \
registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.1
```
-濡傛灉鎮ㄦ病鏈夊畨瑁卍ocker锛屽彲鍙傝�僛Docker瀹夎](#Docker瀹夎)
### 鏈嶅姟绔惎鍔�
@@ -67,33 +64,6 @@
```
------------------
-## Docker瀹夎
-
-涓嬭堪姝ラ涓烘墜鍔ㄥ畨瑁卍ocker鐜鐨勬楠わ細
-
-### docker鐜瀹夎
-```shell
-# Ubuntu锛�
-curl -fsSL https://test.docker.com -o test-docker.sh
-sudo sh test-docker.sh
-# Debian锛�
-curl -fsSL https://get.docker.com -o get-docker.sh
-sudo sh get-docker.sh
-# CentOS锛�
-curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
-# MacOS锛�
-brew install --cask --appdir=/Applications docker
-```
-
-瀹夎璇﹁锛歨ttps://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html
-
-### docker鍚姩
-
-```shell
-sudo systemctl start docker
-```
-
-
## 瀹㈡埛绔敤娉曡瑙�
鍦ㄦ湇鍔″櫒涓婂畬鎴怓unASR鏈嶅姟閮ㄧ讲浠ュ悗锛屽彲浠ラ�氳繃濡備笅鐨勬楠ゆ潵娴嬭瘯鍜屼娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔°��
@@ -155,8 +125,6 @@
```
璇︾粏鍙互鍙傝�冩枃妗o紙[鐐瑰嚮姝ゅ](../java/readme.md)锛�
-
-
## 鏈嶅姟绔敤娉曡瑙o細
### 鍚姩FunASR鏈嶅姟
@@ -212,14 +180,12 @@
--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_cn-en-common-vocab471067-large-onnx/summary)
濡傛灉锛屾偍甯屾湜閮ㄧ讲鎮╢inetune鍚庣殑妯″瀷锛堜緥濡�10epoch.pb锛夛紝闇�瑕佹墜鍔ㄥ皢妯″瀷閲嶅懡鍚嶄负model.pb锛屽苟灏嗗師modelscope涓ā鍨媘odel.pb鏇挎崲鎺夛紝灏嗚矾寰勬寚瀹氫负`model_dir`鍗冲彲銆�
-
## 濡備綍瀹氬埗鏈嶅姟閮ㄧ讲
@@ -235,9 +201,6 @@
### 鑷畾涔夊鎴风锛�
濡傛灉鎮ㄦ兂瀹氫箟鑷繁鐨刢lient锛屽弬鑰僛websocket閫氫俊鍗忚](./websocket_protocol_zh.md)
-
-
-```
### c++ 鏈嶅姟绔細
diff --git a/runtime/docs/SDK_advanced_guide_offline_zh.md b/runtime/docs/SDK_advanced_guide_offline_zh.md
index b4d1e62..4aa32cf 100644
--- a/runtime/docs/SDK_advanced_guide_offline_zh.md
+++ b/runtime/docs/SDK_advanced_guide_offline_zh.md
@@ -4,6 +4,8 @@
鏈枃妗d负FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟寮�鍙戞寚鍗椼�傚鏋滄偍鎯冲揩閫熶綋楠岀绾挎枃浠惰浆鍐欐湇鍔★紝鍙弬鑰僛蹇�熶笂鎵媇(#蹇�熶笂鎵�)銆�
+<img src="images/offline_structure.jpg" width="900"/>
+
## 鏈嶅姟鍣ㄩ厤缃�
鐢ㄦ埛鍙互鏍规嵁鑷繁鐨勪笟鍔¢渶姹傦紝閫夋嫨鍚堥�傜殑鏈嶅姟鍣ㄩ厤缃紝鎺ㄨ崘閰嶇疆涓猴細
@@ -25,6 +27,7 @@
curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh锛�
sudo bash install_docker.sh
```
+docker瀹夎澶辫触璇峰弬鑰� [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
### 闀滃儚鍚姩
@@ -38,7 +41,6 @@
-v $PWD/funasr-runtime-resources/models:/workspace/models \
registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.3.0
```
-濡傛灉鎮ㄦ病鏈夊畨瑁卍ocker锛屽彲鍙傝�僛Docker瀹夎](#Docker瀹夎)
### 鏈嶅姟绔惎鍔�
@@ -57,7 +59,7 @@
# 濡傛灉鎮ㄦ兂鍏抽棴ssl锛屽鍔犲弬鏁帮細--certfile 0
# 濡傛灉鎮ㄦ兂浣跨敤鏃堕棿鎴虫垨鑰卬n鐑瘝妯″瀷杩涜閮ㄧ讲锛岃璁剧疆--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锛堢儹璇嶏級
+# damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx锛坣n鐑瘝锛�
# 濡傛灉鎮ㄦ兂鍦ㄦ湇鍔$鍔犺浇鐑瘝锛岃鍦ㄥ涓绘満鏂囦欢./funasr-runtime-resources/models/hotwords.txt閰嶇疆鐑瘝锛坉ocker鏄犲皠鍦板潃涓�/workspace/models/hotwords.txt锛�:
# 姣忚涓�涓儹璇嶏紝鏍煎紡(鐑瘝 鏉冮噸)锛氶樋閲屽反宸� 20
```
@@ -75,34 +77,6 @@
```shell
python3 funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav"
```
-
-------------------
-## Docker瀹夎
-
-涓嬭堪姝ラ涓烘墜鍔ㄥ畨瑁卍ocker鐜鐨勬楠わ細
-
-### docker鐜瀹夎
-```shell
-# Ubuntu锛�
-curl -fsSL https://test.docker.com -o test-docker.sh
-sudo sh test-docker.sh
-# Debian锛�
-curl -fsSL https://get.docker.com -o get-docker.sh
-sudo sh get-docker.sh
-# CentOS锛�
-curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
-# MacOS锛�
-brew install --cask --appdir=/Applications docker
-```
-
-瀹夎璇﹁锛歨ttps://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html
-
-### docker鍚姩
-
-```shell
-sudo systemctl start docker
-```
-
## 瀹㈡埛绔敤娉曡瑙�
@@ -142,7 +116,6 @@
```
鍛戒护鍙傛暟璇存槑锛�
-
```text
--server-ip 涓篎unASR runtime-SDK鏈嶅姟閮ㄧ讲鏈哄櫒ip锛岄粯璁や负鏈満ip锛�127.0.0.1锛夛紝濡傛灉client涓庢湇鍔′笉鍦ㄥ悓涓�鍙版湇鍔″櫒锛�
闇�瑕佹敼涓洪儴缃叉満鍣╥p
@@ -153,13 +126,11 @@
```
### Html缃戦〉鐗�
-
鍦ㄦ祻瑙堝櫒涓墦寮� html/static/index.html锛屽嵆鍙嚭鐜板涓嬮〉闈紝鏀寔楹﹀厠椋庤緭鍏ヤ笌鏂囦欢涓婁紶锛岀洿鎺ヨ繘琛屼綋楠�
<img src="images/html.png" width="900"/>
### Java-client
-
```shell
FunasrWsClient --host localhost --port 10095 --audio_in ./asr_example.wav --mode offline
```
@@ -233,6 +204,7 @@
濡傛灉锛屾偍甯屾湜閮ㄧ讲鎮╢inetune鍚庣殑妯″瀷锛堜緥濡�10epoch.pb锛夛紝闇�瑕佹墜鍔ㄥ皢妯″瀷閲嶅懡鍚嶄负model.pb锛屽苟灏嗗師modelscope涓ā鍨媘odel.pb鏇挎崲鎺夛紝灏嗚矾寰勬寚瀹氫负`model_dir`鍗冲彲銆�
+------------------
## 濡備綍瀹氬埗鏈嶅姟閮ㄧ讲
@@ -248,9 +220,6 @@
### 鑷畾涔夊鎴风锛�
濡傛灉鎮ㄦ兂瀹氫箟鑷繁鐨刢lient锛屽弬鑰僛websocket閫氫俊鍗忚](./websocket_protocol_zh.md)
-
-
-```
### c++ 鏈嶅姟绔細
diff --git a/runtime/docs/SDK_advanced_guide_online.md b/runtime/docs/SDK_advanced_guide_online.md
index e861555..d9a72b2 100644
--- a/runtime/docs/SDK_advanced_guide_online.md
+++ b/runtime/docs/SDK_advanced_guide_online.md
@@ -3,17 +3,22 @@
FunASR provides a real-time speech transcription service that can be easily deployed on local or cloud servers, with the FunASR runtime-SDK as the core. It integrates the speech endpoint detection (VAD), Paraformer-large non-streaming speech recognition (ASR), Paraformer-large streaming speech recognition (ASR), punctuation (PUNC), and other related capabilities open-sourced by the speech laboratory of DAMO Academy on the Modelscope community. The software package can perform real-time speech-to-text transcription, and can also accurately transcribe text at the end of sentences for high-precision output. The output text contains punctuation and supports high-concurrency multi-channel requests.
## Quick Start
-### Pull Docker Image
-
-Use the following command to pull and start the FunASR software package docker image:
-
+### Docker install
+If you have already installed Docker, ignore this step!
```shell
-sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.3
-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.3
+curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh;
+sudo bash install_docker.sh
```
If you do not have Docker installed, please refer to [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
+### Pull Docker Image
+Use the following command to pull and start the FunASR software package docker image:
+```shell
+sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.4
+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.4
+```
+
### Launching the Server
After Docker is launched, start the funasr-wss-server-2pass service program:
diff --git a/runtime/docs/SDK_advanced_guide_online_zh.md b/runtime/docs/SDK_advanced_guide_online_zh.md
index 463f53d..ff850d4 100644
--- a/runtime/docs/SDK_advanced_guide_online_zh.md
+++ b/runtime/docs/SDK_advanced_guide_online_zh.md
@@ -11,23 +11,22 @@
濡傛灉鎮ㄥ凡瀹夎docker锛屽拷鐣ユ湰姝ラ锛�!
閫氳繃涓嬭堪鍛戒护鍦ㄦ湇鍔″櫒涓婂畨瑁卍ocker锛�
```shell
-curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh锛�
+curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh
sudo bash install_docker.sh
```
+docker瀹夎澶辫触璇峰弬鑰� [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
### 闀滃儚鍚姩
-
閫氳繃涓嬭堪鍛戒护鎷夊彇骞跺惎鍔‵unASR杞欢鍖呯殑docker闀滃儚锛�
```shell
sudo docker pull \
- registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.3
+ registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.4
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.3
+ registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.4
```
-濡傛灉鎮ㄦ病鏈夊畨瑁卍ocker锛屽彲鍙傝�僛Docker瀹夎](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker_zh.html)
### 鏈嶅姟绔惎鍔�
@@ -40,12 +39,15 @@
--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 > log.out 2>&1 &
+ --itn-dir thuduj12/fst_itn_zh \
+ --hotword /workspace/models/hotwords.txt > log.out 2>&1 &
# 濡傛灉鎮ㄦ兂鍏抽棴ssl锛屽鍔犲弬鏁帮細--certfile 0
-# 濡傛灉鎮ㄦ兂浣跨敤鏃堕棿鎴虫垨鑰呯儹璇嶆ā鍨嬭繘琛岄儴缃诧紝璇疯缃�--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锛堢儹璇嶏級
+# 濡傛灉鎮ㄦ兂浣跨敤鏃堕棿鎴虫垨鑰卬n鐑瘝妯″瀷杩涜閮ㄧ讲锛岃璁剧疆--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锛坣n鐑瘝锛�
+# 濡傛灉鎮ㄦ兂鍦ㄦ湇鍔$鍔犺浇鐑瘝锛岃鍦ㄥ涓绘満鏂囦欢./funasr-runtime-resources/models/hotwords.txt閰嶇疆鐑瘝锛坉ocker鏄犲皠鍦板潃涓�/workspace/models/hotwords.txt锛�:
+# 姣忚涓�涓儹璇嶏紝鏍煎紡(鐑瘝 鏉冮噸)锛氶樋閲屽反宸� 20
```
鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔敤娉曡瑙(#鏈嶅姟绔敤娉曡瑙�)
### 瀹㈡埛绔祴璇曚笌浣跨敤
diff --git a/runtime/docs/images/offline_structure.jpg b/runtime/docs/images/offline_structure.jpg
new file mode 100644
index 0000000..772f7c6
--- /dev/null
+++ b/runtime/docs/images/offline_structure.jpg
Binary files differ
diff --git a/runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py b/runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py
index 71cf434..7b13654 100644
--- a/runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py
+++ b/runtime/python/onnxruntime/funasr_onnx/paraformer_bin.py
@@ -36,7 +36,6 @@
intra_op_num_threads: int = 4,
cache_dir: str = None
):
-
if not Path(model_dir).exists():
try:
from modelscope.hub.snapshot_download import snapshot_download
@@ -242,6 +241,13 @@
if not Path(model_dir).exists():
try:
+ from modelscope.hub.snapshot_download import snapshot_download
+ except:
+ raise "You are exporting model from modelscope, please install modelscope and try it again. To install modelscope, you could:\n" \
+ "\npip3 install -U modelscope\n" \
+ "For the users in China, you could install with the command:\n" \
+ "\npip3 install -U modelscope -i https://mirror.sjtu.edu.cn/pypi/web/simple"
+ try:
model_dir = snapshot_download(model_dir, cache_dir=cache_dir)
except:
raise "model_dir must be model_name in modelscope or local path downloaded from modelscope, but is {}".format(model_dir)
--
Gitblit v1.9.1