From 5f47e675864f57836b5e54c894ffed2818f9a460 Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期一, 21 八月 2023 13:05:41 +0800
Subject: [PATCH] Merge branch 'main' of https://github.com/alibaba-damo-academy/FunASR into main

---
 funasr/runtime/websocket/readme.md    |  198 ----------------------------
 funasr/runtime/websocket/readme_zh.md |  179 -------------------------
 2 files changed, 4 insertions(+), 373 deletions(-)

diff --git a/funasr/runtime/websocket/readme.md b/funasr/runtime/websocket/readme.md
index e43500f..ecb8a81 100644
--- a/funasr/runtime/websocket/readme.md
+++ b/funasr/runtime/websocket/readme.md
@@ -1,196 +1,2 @@
-([绠�浣撲腑鏂嘳(./readme_zh.md)|English)
-
-# Service with websocket-cpp
-
-
-## Quick Start
-### Docker Image start
-
-Pull and start the FunASR runtime-SDK Docker image using the following command:
-
-```shell
-sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.1.0
-
-sudo docker run -p 10095:10095 -it --privileged=true -v /root:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.1.0
-```
-
-If you have not installed Docker, please refer to [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html).
-
-### Server Start
-
-After Docker is started, start the funasr-wss-server service program:
-
-```shell
-cd FunASR/funasr/runtime
-./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_zh-cn-common-vocab272727-onnx
-```
-For detailed server parameters, please refer to [Server Parameter Introduction](#Server Parameter Introduction).
-
-### Client Testing and Usage
-
-Download the client test tool directory samples:
-
-```shell
-wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz
-```
-
-We take the Python language client as an example to explain. It supports various audio formats (.wav, .pcm, .mp3, etc.), video input (.mp4, etc.), and multi-file list wav.scp input. For other versions of clients, please refer to the ([docs](#client-usage)).
-
-```shell
-python3 wss_client_asr.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav"
-```
-
-## Detailed Steps
-
-### Dependencies Download and Install
-
-The third-party libraries have been pre-installed in Docker. If not using Docker, please download and install them manually ([Download and Install Third-Party Libraries](requirements_install.md)).
-
-
-### Build runtime
-
-```shell
-git clone https://github.com/alibaba-damo-academy/FunASR.git && cd FunASR/funasr/runtime/websocket
-mkdir build && cd build
-cmake  -DCMAKE_BUILD_TYPE=release .. -DONNXRUNTIME_DIR=/path/to/onnxruntime-linux-x64-1.14.0 -DFFMPEG_DIR=/path/to/ffmpeg-N-111383-g20b8688092-linux64-gpl-shared
-make
-```
-
-
-### Start Service Deployment
-
-#### API-reference锛�
-```text
---download-model-dir Model download address, download the model from Modelscope by setting the model ID. If starting from a local model, this parameter can be left out.
---model-dir ASR model ID in Modelscope or the absolute path of local model
---quantize True for quantized ASR model, False for non-quantized ASR model. Default is True.
---vad-dir VAD model ID in Modelscope or the absolute path of local model
---vad-quant True for quantized VAD model, False for non-quantized VAD model. Default is True.
---punc-dir PUNC model ID in Modelscope or the absolute path of local model
---punc-quant True for quantized PUNC model, False for non-quantized PUNC model. Default is True.
---port Port number for the server to listen on. Default is 10095.
---decoder-thread-num Number of inference threads started by the server. Default is 8.
---io-thread-num Number of IO threads started by the server. Default is 1.
---certfile SSL certificate file. Default is: ../../../ssl_key/server.crt.
---keyfile SSL key file. Default is: ../../../ssl_key/server.key.
-```
-
-#### Example of Starting from Modelscope
-```shell
-./funasr-wss-server  \
-  --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 \
-  --punc-dir damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx
-```
-
-Note: In the above example, `model-dir`锛宍vad-dir`锛宍punc-dir` are the model names in Modelscope, downloaded directly from Modelscope and exported as quantized onnx. If starting from a local model, please change the parameter to the absolute path of the local model.
-
-
-#### Example of Starting from Local Model
-
-##### Export the 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
-```
-
-Export Detailed Introduction锛圼docs](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/export)锛�
-
-##### Start the Service
-```shell
-./funasr-wss-server  \
-  --download-model-dir /workspace/models \
-  --model-dir ./exportdamo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \
-  --vad-dir ./exportdamo/speech_fsmn_vad_zh-cn-16k-common-onnx \
-  --punc-dir ./export/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx
-```
-
-##### Start the 2pass Service
-```shell
-./funasr-wss-server-2pass  \
-  --download-model-dir /workspace/models \
-  --model-dir ./exportdamo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \
-  --vad-dir ./exportdamo/speech_fsmn_vad_zh-cn-16k-common-onnx \
-  --punc-dir ./export/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \
-  --online-model-dir ./exportdamo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online \
-  --quantize false
-```
-
-
-### Client Usage
-
-
-Download the client test tool directory [samples](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz)
-
-```shell
-wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz
-```
-
-After deploying the FunASR service on the server, you can test and use the offline file transcription service through the following steps. Currently, the following programming language client is supported:
-
-- [Python](#python-client)
-- [CPP](#cpp-client)
-- [html](#Html-client)
-- [Java](#Java-client)
-
-#### python-client
-
-If you want to run the client directly for testing, you can refer to the following simple instructions, taking the Python version as an example:
-```shell
-python3 wss_client_asr.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav" --output_dir "./results"
-```
-
-API-reference
-```text
---host: IP address of the machine where FunASR runtime-SDK service is deployed. The default value is the IP address of the local machine (127.0.0.1). If the client and service are not on the same server, it needs to be changed to the IP address of the deployment machine.
---port: The port number of the deployed service is 10095.
---mode: "offline" means offline file transcription.
---audio_in: The audio file that needs to be transcribed, which supports file path and file list (wav.scp).
---output_dir: The path to save the recognition result.
-```
-
-### cpp-client
-
-After entering the directory samples/cpp, you can test it with CPP, as follows:
-
-```shell
-./funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path ../audio/asr_example.wav
-```
-
-API-reference:
-```text
---server-ip: The IP address of the machine where FunASR runtime-SDK service is deployed. The default value is the IP address of the local machine (127.0.0.1). If the client and service are not on the same server, it needs to be changed to the IP address of the deployment machine.
---port: The port number of the deployed service is 10095.
---wav-path: The audio file that needs to be transcribed, which supports file path.
-```
-
-### Html-client
-
-Open `html/static/index.html` in the browser, and you can see the following page, which supports microphone input and file upload for direct experience.
-
-<img src="images/html.png"  width="900"/>
-
-### Java-client
-
-```shell
-FunasrWsClient --host localhost --port 10095 --audio_in ./asr_example.wav --mode offline
-```
-For more details, please refer to the [documentation](../java/readme.md) 
-
-
-## Acknowledge
-1. This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR).
-2. We acknowledge [zhaoming](https://github.com/zhaomingwork/FunASR/tree/add-offline-websocket-srv/funasr/runtime/websocket) for contributing the websocket(cpp-api).
-
-
+# Advanced Development Guide (File transcription service) ([click](../docs/SDK_advanced_guide_offline.md))
+# Real-time Speech Transcription Service Development Guide ([click](../docs/SDK_advanced_guide_online.md))
diff --git a/funasr/runtime/websocket/readme_zh.md b/funasr/runtime/websocket/readme_zh.md
index bcd988c..f1fd950 100644
--- a/funasr/runtime/websocket/readme_zh.md
+++ b/funasr/runtime/websocket/readme_zh.md
@@ -1,178 +1,3 @@
-(绠�浣撲腑鏂噟[English](./readme.md))
+# FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟寮�鍙戞寚鍗�([鐐瑰嚮姝ゅ](../docs/SDK_advanced_guide_offline_zh.md))
 
-# 閲囩敤websocket鍗忚鐨刢++閮ㄧ讲鏂规
-
-## 蹇�熶笂鎵�
-### 鍚姩docker闀滃儚
-
-閫氳繃涓嬭堪鍛戒护鎷夊彇骞跺惎鍔‵unASR runtime-SDK鐨刣ocker闀滃儚锛�
-
-```shell
-sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.1.0
-
-sudo docker run -p 10095:10095 -it --privileged=true -v /root:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.1.0
-```
-濡傛灉鎮ㄦ病鏈夊畨瑁卍ocker锛屽彲鍙傝�僛Docker瀹夎](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html)
-
-### 鏈嶅姟绔惎鍔�
-
-docker鍚姩涔嬪悗锛屽惎鍔� funasr-wss-server鏈嶅姟绋嬪簭锛�
-```shell
-cd FunASR/funasr/runtime
-./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_zh-cn-common-vocab272727-onnx
-```
-鏈嶅姟绔缁嗗弬鏁颁粙缁嶅彲鍙傝�僛鏈嶅姟绔弬鏁颁粙缁峕(#鍛戒护鍙傛暟浠嬬粛)
-
-### 瀹㈡埛绔祴璇曚笌浣跨敤
-
-涓嬭浇瀹㈡埛绔祴璇曞伐鍏风洰褰晄amples
-```shell
-wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz
-```
-鎴戜滑浠ython璇█瀹㈡埛绔负渚嬶紝杩涜璇存槑锛屾敮鎸佸绉嶉煶棰戞牸寮忚緭鍏ワ紙.wav, .pcm, .mp3绛夛級锛屼篃鏀寔瑙嗛杈撳叆(.mp4绛�)锛屼互鍙婂鏂囦欢鍒楄〃wav.scp杈撳叆锛屽叾浠栫増鏈鎴风璇峰弬鑰冩枃妗o紙[鐐瑰嚮姝ゅ](#瀹㈡埛绔敤娉曡瑙�)锛�
-```shell
-python3 wss_client_asr.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav"
-```
-
-------------------
-
-## 鎿嶄綔姝ラ璇﹁В
-
-### 渚濊禆搴撲笅杞�
-
-Docker涓凡缁忛瀹夎浜嗕緷璧栦笁鏂瑰簱锛屽鏋滀笉鐢╠ocker锛岃鎵嬪姩涓嬭浇骞跺畨瑁咃紙[涓夋柟搴撲笅杞戒笌瀹夎](requirements_install.md)锛�
-
-
-### 缂栬瘧
-
-```shell
-git clone https://github.com/alibaba-damo-academy/FunASR.git && cd FunASR/funasr/runtime/websocket
-mkdir build && cd build
-cmake  -DCMAKE_BUILD_TYPE=release .. -DONNXRUNTIME_DIR=/path/to/onnxruntime-linux-x64-1.14.0 -DFFMPEG_DIR=/path/to/ffmpeg-N-111383-g20b8688092-linux64-gpl-shared
-make
-```
-
-### 鍚姩鏈嶅姟閮ㄧ讲
-
-#### 鍛戒护鍙傛暟浠嬬粛锛�
-```text
---download-model-dir 妯″瀷涓嬭浇鍦板潃锛岄�氳繃璁剧疆model ID浠嶮odelscope涓嬭浇妯″瀷銆傚鏋滀粠鏈湴妯″瀷鍚姩锛屽彲浠ヤ笉璁剧疆銆�
---model-dir  modelscope 涓� ASR model ID锛屾垨鑰呮湰鍦版ā鍨嬬粷瀵硅矾寰�
---quantize  True涓洪噺鍖朅SR妯″瀷锛孎alse涓洪潪閲忓寲ASR妯″瀷锛岄粯璁ゆ槸True
---vad-dir  modelscope 涓� VAD model ID锛屾垨鑰呮湰鍦版ā鍨嬬粷瀵硅矾寰�
---vad-quant   True涓洪噺鍖朧AD妯″瀷锛孎alse涓洪潪閲忓寲VAD妯″瀷锛岄粯璁ゆ槸True
---punc-dir  modelscope 涓� 鏍囩偣 model ID锛屾垨鑰呮湰鍦版ā鍨嬬粷瀵硅矾寰�
---punc-quant   True涓洪噺鍖朠UNC妯″瀷锛孎alse涓洪潪閲忓寲PUNC妯″瀷锛岄粯璁ゆ槸True
---port  鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095
---decoder-thread-num  鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8
---io-thread-num  鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1
---certfile  ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt
---keyfile   ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key
-```
-
-#### 浠巑odelscope涓ā鍨嬪惎鍔ㄧず渚�
-```shell
-./funasr-wss-server  \
-  --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 \
-  --punc-dir damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx
-```
-
-娉ㄦ剰锛氫笂闈㈢ず渚嬩腑锛宍model-dir`锛宍vad-dir`锛宍punc-dir`涓烘ā鍨嬪湪modelscope涓ā鍨嬪悕瀛楋紝鐩存帴浠巑odelscope涓嬭浇妯″瀷骞朵笖瀵煎嚭閲忓寲鍚庣殑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
-```
-瀵煎嚭杩囩▼璇︾粏浠嬬粛锛圼鐐瑰嚮姝ゅ](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/export)锛�
-
-##### 鍚姩鏈嶅姟
-```shell
-./funasr-wss-server  \
-  --download-model-dir /workspace/models \
-  --model-dir ./exportdamo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \
-  --vad-dir ./exportdamo/speech_fsmn_vad_zh-cn-16k-common-onnx \
-  --punc-dir ./export/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx
-```
-
-
-
-### 瀹㈡埛绔敤娉曡瑙�
-
-涓嬭浇瀹㈡埛绔祴璇曞伐鍏风洰褰晄amples
-```shell
-wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz
-```
-
-鍦ㄦ湇鍔″櫒涓婂畬鎴怓unASR鏈嶅姟閮ㄧ讲浠ュ悗锛屽彲浠ラ�氳繃濡備笅鐨勬楠ゆ潵娴嬭瘯鍜屼娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔°��
-鐩墠鍒嗗埆鏀寔浠ヤ笅鍑犵缂栫▼璇█瀹㈡埛绔�
-
-- [Python](#python-client)
-- [CPP](#cpp-client)
-- [html缃戦〉鐗堟湰](#Html缃戦〉鐗�)
-- [Java](#Java-client)
-
-#### python-client
-鑻ユ兂鐩存帴杩愯client杩涜娴嬭瘯锛屽彲鍙傝�冨涓嬬畝鏄撹鏄庯紝浠ython鐗堟湰涓轰緥锛�
-
-```shell
-python3 wss_client_asr.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav" --output_dir "./results"
-```
-
-鍛戒护鍙傛暟璇存槑锛�
-```text
---host 涓篎unASR runtime-SDK鏈嶅姟閮ㄧ讲鏈哄櫒ip锛岄粯璁や负鏈満ip锛�127.0.0.1锛夛紝濡傛灉client涓庢湇鍔′笉鍦ㄥ悓涓�鍙版湇鍔″櫒锛岄渶瑕佹敼涓洪儴缃叉満鍣╥p
---port 10095 閮ㄧ讲绔彛鍙�
---mode offline琛ㄧず绂荤嚎鏂囦欢杞啓
---audio_in 闇�瑕佽繘琛岃浆鍐欑殑闊抽鏂囦欢锛屾敮鎸佹枃浠惰矾寰勶紝鏂囦欢鍒楄〃wav.scp
---output_dir 璇嗗埆缁撴灉淇濆瓨璺緞
-```
-
-### cpp-client
-杩涘叆samples/cpp鐩綍鍚庯紝鍙互鐢╟pp杩涜娴嬭瘯锛屾寚浠ゅ涓嬶細
-```shell
-./funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path ../audio/asr_example.wav
-```
-
-鍛戒护鍙傛暟璇存槑锛�
-
-```text
---server-ip 涓篎unASR runtime-SDK鏈嶅姟閮ㄧ讲鏈哄櫒ip锛岄粯璁や负鏈満ip锛�127.0.0.1锛夛紝濡傛灉client涓庢湇鍔′笉鍦ㄥ悓涓�鍙版湇鍔″櫒锛岄渶瑕佹敼涓洪儴缃叉満鍣╥p
---port 10095 閮ㄧ讲绔彛鍙�
---wav-path 闇�瑕佽繘琛岃浆鍐欑殑闊抽鏂囦欢锛屾敮鎸佹枃浠惰矾寰�
-```
-
-### 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
-```
-璇︾粏鍙互鍙傝�冩枃妗o紙[鐐瑰嚮姝ゅ](../java/readme.md)锛�
-
-
-
-## Acknowledge
-1. This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR).
-2. We acknowledge [zhaoming](https://github.com/zhaomingwork/FunASR/tree/add-offline-websocket-srv/funasr/runtime/websocket) for contributing the websocket(cpp-api).
-
-
+# FunASR瀹炴椂璇煶鍚啓鏈嶅姟寮�鍙戞寚鍗�([鐐瑰嚮姝ゅ](../docs/SDK_advanced_guide_online_zh.md))

--
Gitblit v1.9.1