From 9799a7ba3bd740e4f5dc0b0125d6e609601d7764 Mon Sep 17 00:00:00 2001 From: 游雁 <zhifu.gzf@alibaba-inc.com> Date: 星期五, 30 六月 2023 22:55:31 +0800 Subject: [PATCH] docs --- /dev/null | 331 ------------------------------------ funasr/runtime/docs/SDK_tutorial_zh.md | 170 ++++++++++++++++++ funasr/runtime/readme_cn.md | 14 3 files changed, 177 insertions(+), 338 deletions(-) diff --git a/funasr/runtime/docs/SDK_tutorial_cn.md b/funasr/runtime/docs/SDK_tutorial_cn.md deleted file mode 100644 index 123abb1..0000000 --- a/funasr/runtime/docs/SDK_tutorial_cn.md +++ /dev/null @@ -1,331 +0,0 @@ -# FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟渚挎嵎閮ㄧ讲鏁欑▼ - -FunASR鎻愪緵鍙究鎹锋湰鍦版垨鑰呬簯绔湇鍔″櫒閮ㄧ讲鐨勭绾挎枃浠惰浆鍐欐湇鍔★紝鍐呮牳涓篎unASR宸插紑婧恟untime-SDK銆傞泦鎴愪簡杈炬懇闄㈣闊冲疄楠屽鍦∕odelscope绀惧尯寮�婧愮殑璇煶绔偣妫�娴�(VAD)銆丳araformer-large璇煶璇嗗埆(ASR)銆佹爣鐐规仮澶�(PUNC) 绛夌浉鍏宠兘鍔涳紝鍙互鍑嗙‘銆侀珮鏁堢殑瀵归煶棰戣繘琛岄珮骞跺彂杞啓銆� - -## 鐜瀹夎涓庡惎鍔ㄦ湇鍔� - -鏈嶅姟鍣ㄩ厤缃笌鐢宠锛堝厤璐硅瘯鐢�1锝�3涓湀锛夛紙[鐐瑰嚮姝ゅ](./aliyun_server_tutorial.md)锛� -### 鑾峰緱鑴氭湰宸ュ叿骞朵竴閿儴缃� - -閫氳繃浠ヤ笅鍛戒护杩愯涓�閿儴缃叉湇鍔★紝鎸夌収鎻愮ず閫愭瀹屾垚FunASR runtime-SDK鏈嶅姟鐨勯儴缃插拰杩愯銆傜洰鍓嶆殏鏃朵粎鏀寔Linux鐜锛屽叾浠栫幆澧冨弬鑰冩枃妗楂橀樁寮�鍙戞寚鍗梋(./SDK_advanced_guide_cn.md) - -[//]: # (鍙楅檺浜庣綉缁滐紝funasr-runtime-deploy.sh涓�閿儴缃插伐鍏风殑涓嬭浇鍙兘涓嶉『鍒╋紝閬囧埌鏁扮杩樻湭涓嬭浇杩涘叆涓�閿儴缃插伐鍏风殑鎯呭喌锛岃Ctrl + C 缁堟鍚庡啀娆¤繍琛屼互涓嬪懡浠ゃ��) - -```shell -curl -O https://raw.githubusercontent.com/alibaba-damo-academy/FunASR/main/funasr/runtime/funasr-runtime-deploy.sh; sudo bash funasr-runtime-deploy.sh install -# 濡傞亣鍒扮綉缁滈棶棰橈紝涓浗澶ч檰鐢ㄦ埛锛屽彲浠ョ敤涓笅闈㈢殑鍛戒护锛� -# curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy.sh; sudo bash funasr-runtime-deploy.sh install - -``` - -#### 鍚姩杩囩▼閰嶇疆璇﹁В - -##### 閫夋嫨FunASR Docker闀滃儚 -鎺ㄨ崘閫夋嫨latest浣跨敤鎴戜滑鐨勬渶鏂伴暅鍍忥紝涔熷彲閫夋嫨鍘嗗彶鐗堟湰銆� -```text -[1/9] - Please choose the Docker image. - 1) registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest - 2) registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.1.0 - Enter your choice: 1 - You have chosen the Docker image: registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest -``` - -##### 閫夋嫨ASR/VAD/PUNC妯″瀷 - -浣犲彲浠ラ�夋嫨ModelScope涓殑妯″瀷锛屼篃鍙互閫�<model_name>鑷濉叆ModelScope涓殑妯″瀷鍚嶏紝灏嗕細鍦―ocker杩愯鏃惰嚜鍔ㄤ笅杞姐�傚悓鏃朵篃鍙互閫夋嫨<model_path>濉叆瀹夸富鏈轰腑鐨勬湰鍦版ā鍨嬭矾寰勩�� - -```text -[2/9] - Please input [Y/n] to confirm whether to automatically download model_id in ModelScope or use a local model. - [y] With the model in ModelScope, the model will be automatically downloaded to Docker(/workspace/models). - If you select both the local model and the model in ModelScope, select [y]. - [n] Use the models on the localhost, the directory where the model is located will be mapped to Docker. - Setting confirmation[Y/n]: - You have chosen to use the model in ModelScope, please set the model ID in the next steps, and the model will be automatically downloaded in (/workspace/models) during the run. - - Please enter the local path to download models, the corresponding path in Docker is /workspace/models. - Setting the local path to download models, default(/root/models): - The local path(/root/models) set will store models during the run. - - [2.1/9] - Please select ASR model_id in ModelScope from the list below. - 1) damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx - 2) model_name - 3) model_path - Enter your choice: 1 - The model ID is damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx - The model dir in Docker is /workspace/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx - - [2.2/9] - Please select VAD model_id in ModelScope from the list below. - 1) damo/speech_fsmn_vad_zh-cn-16k-common-onnx - 2) model_name - 3) model_path - Enter your choice: 1 - The model ID is damo/speech_fsmn_vad_zh-cn-16k-common-onnx - The model dir in Docker is /workspace/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx - - [2.3/9] - Please select PUNC model_id in ModelScope from the list below. - 1) damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx - 2) model_name - 3) model_path - Enter your choice: 1 - The model ID is damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx - The model dir in Docker is /workspace/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx -``` - -##### 杈撳叆瀹夸富鏈轰腑FunASR鏈嶅姟鍙墽琛岀▼搴忚矾寰� - -杈撳叆FunASR鏈嶅姟鍙墽琛岀▼搴忕殑瀹夸富鏈鸿矾寰勶紝Docker杩愯鏃跺皢鑷姩鎸傝浇鍒癉ocker涓繍琛屻�傞粯璁や笉杈撳叆鐨勬儏鍐典笅灏嗘寚瀹欴ocker涓粯璁ょ殑/workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server銆� - -```text -[3/9] - Please enter the path to the excutor of the FunASR service on the localhost. - If not set, the default /workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server in Docker is used. - Setting the path to the excutor of the FunASR service on the localhost: - Corresponding, the path of FunASR in Docker is /workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server -``` - -##### 璁剧疆瀹夸富鏈烘彁渚涚粰FunASR鐨勭鍙� -璁剧疆鎻愪緵缁橠ocker鐨勫涓绘満绔彛锛岄粯璁や负10095銆傝淇濊瘉姝ょ鍙e彲鐢ㄣ�� -```text -[4/9] - Please input the opened port in the host used for FunASR server. - Default: 10095 - Setting the opened host port [1-65535]: - The port of the host is 10095 - The port in Docker for FunASR server is 10095 -``` - - -##### 璁剧疆FunASR鏈嶅姟鐨勬帹鐞嗙嚎绋嬫暟 -璁剧疆FunASR鏈嶅姟鐨勬帹鐞嗙嚎绋嬫暟锛岄粯璁や负瀹夸富鏈烘牳鏁帮紝鍚屾椂鑷姩璁剧疆鏈嶅姟鐨処O绾跨▼鏁帮紝涓烘帹鐞嗙嚎绋嬫暟鐨勫洓鍒嗕箣涓�銆� -```text -[5/9] - Please input thread number for FunASR decoder. - Default: 1 - Setting the number of decoder thread: - - The number of decoder threads is 1 - The number of IO threads is 1 -``` - -##### 鎵�鏈夎缃弬鏁板睍绀哄強纭 - -灞曠ず鍓嶉潰6姝ヨ缃殑鍙傛暟锛岀‘璁ゅ垯灏嗘墍鏈夊弬鏁板瓨鍌ㄥ埌/var/funasr/config锛屽苟寮�濮嬪惎鍔―ocker锛屽惁鍒欐彁绀虹敤鎴疯繘琛岄噸鏂拌缃�� - -```text - -[6/9] - Show parameters of FunASR server setting and confirm to run ... - - The current Docker image is : registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest - The model is downloaded or stored to this directory in local : /root/models - The model will be automatically downloaded to the directory : /workspace/models - The ASR model_id used : damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx - The ASR model directory corresponds to the directory in Docker : /workspace/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx - The VAD model_id used : damo/speech_fsmn_vad_zh-cn-16k-common-onnx - The VAD model directory corresponds to the directory in Docker : /workspace/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx - The PUNC model_id used : damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx - The PUNC model directory corresponds to the directory in Docker: /workspace/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx - - The path in the docker of the FunASR service executor : /workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server - Set the host port used for use by the FunASR service : 10095 - Set the docker port used by the FunASR service : 10095 - Set the number of threads used for decoding the FunASR service : 1 - Set the number of threads used for IO the FunASR service : 1 - - Please input [Y/n] to confirm the parameters. - [y] Verify that these parameters are correct and that the service will run. - [n] The parameters set are incorrect, it will be rolled out, please rerun. - read confirmation[Y/n]: - - Will run FunASR server later ... - Parameters are stored in the file /var/funasr/config -``` - -##### 妫�鏌ocker鏈嶅姟 - -妫�鏌ュ綋鍓嶅涓绘満鏄惁瀹夎浜咲ocker鏈嶅姟锛岃嫢鏈畨瑁咃紝鍒欏畨瑁匘ocker骞跺惎鍔ㄣ�� - -```text -[7/9] - Start install docker for ubuntu - Get docker installer: curl -fsSL https://test.docker.com -o test-docker.sh - Get docker run: sudo sh test-docker.sh -# Executing docker install script, commit: c2de0811708b6d9015ed1a2c80f02c9b70c8ce7b -+ sh -c apt-get update -qq >/dev/null -+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null -+ sh -c install -m 0755 -d /etc/apt/keyrings -+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg -+ sh -c chmod a+r /etc/apt/keyrings/docker.gpg -+ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal test" > /etc/apt/sources.list.d/docker.list -+ sh -c apt-get update -qq >/dev/null -+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null -+ sh -c docker version -Client: Docker Engine - Community - Version: 24.0.2 - - ... - ... - - Docker install success, start docker server. -``` - -##### 涓嬭浇FunASR Docker闀滃儚 - -涓嬭浇骞舵洿鏂皊tep1.1涓�夋嫨鐨凢unASR Docker闀滃儚銆� - -```text -[8/9] - Pull docker image(registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest)... -funasr-runtime-cpu-0.0.1: Pulling from funasr_repo/funasr -7608715873ec: Pull complete -3e1014c56f38: Pull complete - - ... - ... -``` - -##### 鍚姩FunASR Docker - -鍚姩FunASR Docker锛岀瓑寰卻tep1.2閫夋嫨鐨勬ā鍨嬩笅杞藉畬鎴愬苟鍚姩FunASR鏈嶅姟銆� - -```text -[9/9] - Construct command and run docker ... -943d8f02b4e5011b71953a0f6c1c1b9bc5aff63e5a96e7406c83e80943b23474 - - Loading models: - [ASR ][Done ][==================================================][100%][1.10MB/s][v1.2.1] - [VAD ][Done ][==================================================][100%][7.26MB/s][v1.2.0] - [PUNC][Done ][==================================================][100%][ 474kB/s][v1.1.7] - The service has been started. - If you want to see an example of how to use the client, you can run sudo bash funasr-runtime-deploy.sh -c . -``` - -#### 鍚姩宸茬粡閮ㄧ讲杩囩殑FunASR鏈嶅姟 -涓�閿儴缃插悗鑻ュ嚭鐜伴噸鍚數鑴戠瓑鍏抽棴Docker鐨勫姩浣滐紝鍙�氳繃濡備笅鍛戒护鐩存帴鍚姩FunASR鏈嶅姟锛屽惎鍔ㄩ厤缃负涓婃涓�閿儴缃茬殑璁剧疆銆� - -```shell -sudo bash funasr-runtime-deploy.sh start -``` - -#### 鍏抽棴FunASR鏈嶅姟 - -```shell -sudo bash funasr-runtime-deploy.sh stop -``` - -#### 閲嶅惎FunASR鏈嶅姟 - -鏍规嵁涓婃涓�閿儴缃茬殑璁剧疆閲嶅惎鍚姩FunASR鏈嶅姟銆� -```shell -sudo bash funasr-runtime-deploy.sh restart -``` - -#### 鏇挎崲妯″瀷骞堕噸鍚疐unASR鏈嶅姟 - -鏇挎崲姝e湪浣跨敤鐨勬ā鍨嬶紝骞堕噸鏂板惎鍔‵unASR鏈嶅姟銆傛ā鍨嬮渶涓篗odelScope涓殑ASR/VAD/PUNC妯″瀷锛屾垨鑰呬粠ModelScope涓ā鍨媐inetune鍚庣殑妯″瀷銆� - -```shell -sudo bash funasr-runtime-deploy.sh update model <model ID> - -e.g -sudo bash funasr-runtime-deploy.sh update model damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch -``` - -### 娴嬭瘯涓庝娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔� - -鍦ㄦ湇鍔″櫒涓婂畬鎴怓unASR鏈嶅姟閮ㄧ讲浠ュ悗锛屽彲浠ラ�氳繃濡備笅鐨勬楠ゆ潵娴嬭瘯鍜屼娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔°�傜洰鍓嶅垎鍒敮鎸丳ython銆丆++銆丣ava鐗堟湰client鐨勭殑鍛戒护琛岃繍琛岋紝浠ュ強鍙湪娴忚鍣ㄥ彲鐩存帴浣撻獙鐨刪tml缃戦〉鐗堟湰锛屾洿澶氳瑷�client鏀寔鍙傝�冩枃妗c�怓unASR楂橀樁寮�鍙戞寚鍗椼�戙�� -funasr-runtime-deploy.sh杩愯缁撴潫鍚庯紝鍙�氳繃鍛戒护浠ヤ氦浜掔殑褰㈠紡鑷姩涓嬭浇娴嬭瘯鏍蜂緥samples鍒板綋鍓嶇洰褰曠殑funasr_samples涓紝骞惰缃弬鏁拌繍琛岋細 - -```shell -sudo bash funasr-runtime-deploy.sh client -``` - -鍙�夋嫨鎻愪緵鐨凱ython鍜孡inux C++鑼冧緥绋嬪簭锛屼互Python鑼冧緥涓轰緥锛� - -```text -Will download sample tools for the client to show how speech recognition works. - Please select the client you want to run. - 1) Python - 2) Linux_Cpp - Enter your choice: 1 - - Please enter the IP of server, default(127.0.0.1): - Please enter the port of server, default(10095): - Please enter the audio path, default(/root/funasr_samples/audio/asr_example.wav): - - Run pip3 install click>=8.0.4 -Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/ -Requirement already satisfied: click>=8.0.4 in /usr/local/lib/python3.8/dist-packages (8.1.3) - - Run pip3 install -r /root/funasr_samples/python/requirements_client.txt -Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/ -Requirement already satisfied: websockets in /usr/local/lib/python3.8/dist-packages (from -r /root/funasr_samples/python/requirements_client.txt (line 1)) (11.0.3) - - Run python3 /root/funasr_samples/python/wss_client_asr.py --host 127.0.0.1 --port 10095 --mode offline --audio_in /root/funasr_samples/audio/asr_example.wav --send_without_sleep --output_dir ./funasr_samples/python - - ... - ... - - pid0_0: 娆㈣繋澶у鏉ヤ綋楠岃揪鎽╅櫌鎺ㄥ嚭鐨勮闊宠瘑鍒ā鍨嬨�� -Exception: sent 1000 (OK); then received 1000 (OK) -end - - If failed, you can try (python3 /root/funasr_samples/python/wss_client_asr.py --host 127.0.0.1 --port 10095 --mode offline --audio_in /root/funasr_samples/audio/asr_example.wav --send_without_sleep --output_dir ./funasr_samples/python) in your Shell. - -``` - -#### 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" --send_without_sleep --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 - -```shell -export LD_LIBRARY_PATH=/root/funasr_samples/cpp/libs:$LD_LIBRARY_PATH -/root/funasr_samples/cpp/funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path /root/funasr_samples/audio/asr_example.wav -``` - -鍛戒护鍙傛暟璇存槑锛� - -```text ---server-ip 涓篎unASR runtime-SDK鏈嶅姟閮ㄧ讲鏈哄櫒ip锛岄粯璁や负鏈満ip锛�127.0.0.1锛夛紝濡傛灉client涓庢湇鍔′笉鍦ㄥ悓涓�鍙版湇鍔″櫒锛岄渶瑕佹敼涓洪儴缃叉満鍣╥p ---port 10095 閮ㄧ讲绔彛鍙� ---wav-path 闇�瑕佽繘琛岃浆鍐欑殑闊抽鏂囦欢锛屾敮鎸佹枃浠惰矾寰� -``` - -### 瑙嗛demo - -[鐐瑰嚮姝ゅ]() - - - - - - - - - - - - - - - diff --git a/funasr/runtime/docs/SDK_tutorial_zh.md b/funasr/runtime/docs/SDK_tutorial_zh.md new file mode 100644 index 0000000..1fe26bd --- /dev/null +++ b/funasr/runtime/docs/SDK_tutorial_zh.md @@ -0,0 +1,170 @@ +# FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟渚挎嵎閮ㄧ讲鏁欑▼ + +FunASR鎻愪緵鍙究鎹锋湰鍦版垨鑰呬簯绔湇鍔″櫒閮ㄧ讲鐨勭绾挎枃浠惰浆鍐欐湇鍔★紝鍐呮牳涓篎unASR宸插紑婧恟untime-SDK銆� +闆嗘垚浜嗚揪鎽╅櫌璇煶瀹為獙瀹ゅ湪Modelscope绀惧尯寮�婧愮殑璇煶绔偣妫�娴�(VAD)銆丳araformer-large璇煶璇嗗埆(ASR)銆佹爣鐐规仮澶�(PUNC) 绛夌浉鍏宠兘鍔涳紝鎷ユ湁瀹屾暣鐨勮闊宠瘑鍒摼璺紝鍙互灏嗗嚑鍗佷釜灏忔椂鐨勯煶棰戣瘑鍒垚甯︽爣鐐圭殑鏂囧瓧锛岃�屼笖鏀寔涓婄櫨璺苟鍙戝悓鏃惰繘琛岃瘑鍒�� + +## 鏈嶅姟鍣ㄩ厤缃� + +鐢ㄦ埛鍙互鏍规嵁鑷繁鐨勪笟鍔¢渶姹傦紝閫夋嫨鍚堥�傜殑鏈嶅姟鍣ㄩ厤缃紝鎺ㄨ崘閰嶇疆涓猴細 +- 閰嶇疆1: 锛圶86锛岃绠楀瀷锛夛紝4鏍竩CPU锛屽唴瀛�8G锛屽崟鏈哄彲浠ユ敮鎸佸ぇ绾�32璺殑璇锋眰 +- 閰嶇疆2: 锛圶86锛岃绠楀瀷锛夛紝16鏍竩CPU锛屽唴瀛�32G锛屽崟鏈哄彲浠ユ敮鎸佸ぇ绾�64璺殑璇锋眰 +- 閰嶇疆3: 锛圶86锛岃绠楀瀷锛夛紝64鏍竩CPU锛屽唴瀛�128G锛屽崟鏈哄彲浠ユ敮鎸佸ぇ绾�200璺殑璇锋眰 + +璇︾粏鎬ц兘娴嬭瘯鎶ュ憡锛歔鐐规閾炬帴](./benchmark_onnx_cpp.md) + +浜戞湇鍔″巶鍟嗭紝閽堝鏂扮敤鎴凤紝鏈�3涓湀鍏嶈垂璇曠敤娲诲姩锛岀敵璇锋暀绋嬶紙[鐐瑰嚮姝ゅ](./aliyun_server_tutorial.md)锛� + +## 蹇�熶笂鎵� + +閫氳繃浠ヤ笅鍛戒护杩愯涓�閿儴缃叉湇鍔★紝鎸夌収鎻愮ず閫愭瀹屾垚FunASR runtime-SDK鏈嶅姟鐨勯儴缃插拰杩愯銆傜洰鍓嶆殏鏃朵粎鏀寔Linux鐜锛屽叾浠栫幆澧冨弬鑰冩枃妗楂橀樁寮�鍙戞寚鍗梋(./SDK_advanced_guide_cn.md) + +```shell +curl -O https://raw.githubusercontent.com/alibaba-damo-academy/FunASR/main/funasr/runtime/funasr-runtime-deploy.sh; sudo bash funasr-runtime-deploy.sh install +# 濡傞亣鍒扮綉缁滈棶棰橈紝涓浗澶ч檰鐢ㄦ埛锛屽彲浠ョ敤涓笅闈㈢殑鍛戒护锛� +# curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy.sh; sudo bash funasr-runtime-deploy.sh install +``` + +## 娴嬭瘯涓庝娇鐢� + +鍦ㄦ湇鍔″櫒涓婂畬鎴怓unASR鏈嶅姟閮ㄧ讲浠ュ悗锛屽彲浠ラ�氳繃濡備笅鐨勬楠ゆ潵娴嬭瘯鍜屼娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔°�� +鐩墠鍒嗗埆鏀寔浠ヤ笅鍑犵缂栫▼璇█瀹㈡埛绔� + +- Python +- C++ +- Java +- html缃戦〉鐗堟湰 + +鎴戜滑浠ython璇█瀹㈡埛绔负渚嬶紝杩涜璇存槑锛屽叾浠栫増鏈鎴风璇峰弬鑰僛寮�鍙戞寚鍗梋() + +#### 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" --send_without_sleep --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) + +[//]: # () +[//]: # (```shell) + +[//]: # (export LD_LIBRARY_PATH=/root/funasr_samples/cpp/libs:$LD_LIBRARY_PATH) + +[//]: # (/root/funasr_samples/cpp/funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path /root/funasr_samples/audio/asr_example.wav) + +[//]: # (```) + +[//]: # () +[//]: # (鍛戒护鍙傛暟璇存槑锛�) + +[//]: # () +[//]: # (```text) + +[//]: # (--server-ip 涓篎unASR runtime-SDK鏈嶅姟閮ㄧ讲鏈哄櫒ip锛岄粯璁や负鏈満ip锛�127.0.0.1锛夛紝濡傛灉client涓庢湇鍔′笉鍦ㄥ悓涓�鍙版湇鍔″櫒锛岄渶瑕佹敼涓洪儴缃叉満鍣╥p) + +[//]: # (--port 10095 閮ㄧ讲绔彛鍙�) + +[//]: # (--wav-path 闇�瑕佽繘琛岃浆鍐欑殑闊抽鏂囦欢锛屾敮鎸佹枃浠惰矾寰�) + +[//]: # (```) + +## 鏈嶅姟绔父瑙佹搷浣滀粙缁� + +### 鍚姩宸茬粡閮ㄧ讲杩囩殑FunASR鏈嶅姟 +涓�閿儴缃插悗鑻ュ嚭鐜伴噸鍚數鑴戠瓑鍏抽棴Docker鐨勫姩浣滐紝鍙�氳繃濡備笅鍛戒护鐩存帴鍚姩FunASR鏈嶅姟锛屽惎鍔ㄩ厤缃负涓婃涓�閿儴缃茬殑璁剧疆銆� + +```shell +sudo bash funasr-runtime-deploy.sh start +``` + +### 鍏抽棴FunASR鏈嶅姟 + +```shell +sudo bash funasr-runtime-deploy.sh stop +``` + +### 閲嶅惎FunASR鏈嶅姟 + +鏍规嵁涓婃涓�閿儴缃茬殑璁剧疆閲嶅惎鍚姩FunASR鏈嶅姟銆� +```shell +sudo bash funasr-runtime-deploy.sh restart +``` + +### 鏇挎崲妯″瀷骞堕噸鍚疐unASR鏈嶅姟 + +鏇挎崲姝e湪浣跨敤鐨勬ā鍨嬶紝骞堕噸鏂板惎鍔‵unASR鏈嶅姟銆傛ā鍨嬮渶涓篗odelScope涓殑ASR/VAD/PUNC妯″瀷锛屾垨鑰呬粠ModelScope涓ā鍨媐inetune鍚庣殑妯″瀷銆� + +```shell +sudo bash funasr-runtime-deploy.sh update model <model ID> + +e.g +sudo bash funasr-runtime-deploy.sh update model damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch +``` + + +### 鏈嶅姟绔惎鍔ㄨ繃绋嬮厤缃瑙� + +##### 閫夋嫨FunASR Docker闀滃儚 +鎺ㄨ崘閫夋嫨latest浣跨敤鎴戜滑鐨勬渶鏂伴暅鍍忥紝涔熷彲閫夋嫨鍘嗗彶鐗堟湰銆� +```text +[1/9] + Please choose the Docker image. + 1) registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest + 2) registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.1.0 + Enter your choice: 1 + You have chosen the Docker image: registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest +``` + + +##### 璁剧疆瀹夸富鏈烘彁渚涚粰FunASR鐨勭鍙� +璁剧疆鎻愪緵缁橠ocker鐨勫涓绘満绔彛锛岄粯璁や负10095銆傝淇濊瘉姝ょ鍙e彲鐢ㄣ�� +```text +[4/9] + Please input the opened port in the host used for FunASR server. + Default: 10095 + Setting the opened host port [1-65535]: + The port of the host is 10095 + The port in Docker for FunASR server is 10095 +``` + + +##### 璁剧疆FunASR鏈嶅姟鐨勬帹鐞嗙嚎绋嬫暟 +璁剧疆FunASR鏈嶅姟鐨勬帹鐞嗙嚎绋嬫暟锛岄粯璁や负瀹夸富鏈烘牳鏁帮紝鍚屾椂鑷姩璁剧疆鏈嶅姟鐨処O绾跨▼鏁帮紝涓烘帹鐞嗙嚎绋嬫暟鐨勫洓鍒嗕箣涓�銆� +```text +[5/9] + Please input thread number for FunASR decoder. + Default: 1 + Setting the number of decoder thread: + + The number of decoder threads is 1 + The number of IO threads is 1 +``` + + +## 瑙嗛demo + +[鐐瑰嚮姝ゅ]() + + + + + + + + + + + + + + + diff --git a/funasr/runtime/readme_cn.md b/funasr/runtime/readme_cn.md index 07b391a..dce2db4 100644 --- a/funasr/runtime/readme_cn.md +++ b/funasr/runtime/readme_cn.md @@ -14,18 +14,18 @@ ## 涓枃绂荤嚎鏂囦欢杞啓鏈嶅姟閮ㄧ讲锛圕PU鐗堟湰锛� -鐩墠FunASR runtime-SDK-0.0.1鐗堟湰宸叉敮鎸佷腑鏂囪闊崇绾挎枃浠舵湇鍔¢儴缃诧紙CPU鐗堟湰锛夛紝鎷ユ湁瀹屾暣鐨勮闊宠瘑鍒摼璺紝鍙互灏嗗嚑鍗佷釜灏忔椂鐨勯煶棰戣瘑鍒垚甯︽爣鐐圭殑鏂囧瓧锛岃�屼笖鏀寔涓婄櫨璺苟鍙戝悓鏃惰繘琛岃瘑鍒�� +涓枃璇煶绂荤嚎鏂囦欢鏈嶅姟閮ㄧ讲锛圕PU鐗堟湰锛夛紝鎷ユ湁瀹屾暣鐨勮闊宠瘑鍒摼璺紝鍙互灏嗗嚑鍗佷釜灏忔椂鐨勯煶棰戣瘑鍒垚甯︽爣鐐圭殑鏂囧瓧锛岃�屼笖鏀寔涓婄櫨璺苟鍙戝悓鏃惰繘琛岃瘑鍒�� +涓轰簡鏀寔涓嶅悓鐢ㄦ埛鐨勯渶姹傦紝閽堝涓嶅悓鍦烘櫙锛屽噯澶囦簡涓嶅悓鐨勫浘鏂囨暀绋嬶細 -涓轰簡鏀寔涓嶅悓鐢ㄦ埛鐨勯渶姹傦紝鎴戜滑鍒嗗埆閽堝灏忕櫧涓庨珮闃跺紑鍙戣�咃紝鍑嗗浜嗕笉鍚岀殑鍥炬枃鏁欑▼锛� +### 渚挎嵎閮ㄧ讲鏁欑▼ + +閫傜敤鍦烘櫙涓猴紝瀵规湇鍔¢儴缃睸DK鏃犱慨鏀归渶姹傦紝閮ㄧ讲妯″瀷鏉ヨ嚜浜嶮odelScope锛屾垨鑰呯敤鎴穎inetune锛岃缁嗘暀绋嬪弬鑰冿紙[鐐瑰嚮姝ゅ](./docs/SDK_tutorial_cn.md)锛� ### 鎶�鏈師鐞嗘彮绉� 鏂囨。浠嬬粛浜嗚儗鍚庢妧鏈師鐞嗭紝璇嗗埆鍑嗙‘鐜囷紝璁$畻鏁堢巼绛夛紝浠ュ強鏍稿績浼樺娍浠嬬粛锛氫究鎹枫�侀珮绮惧害銆侀珮鏁堢巼銆侀暱闊抽閾捐矾锛岃缁嗘枃妗e弬鑰冿紙[鐐瑰嚮姝ゅ](https://mp.weixin.qq.com/s?__biz=MzA3MTQ0NTUyMw==&tempkey=MTIyNF84d05USjMxSEpPdk5GZXBJUFNJNzY0bU1DTkxhV19mcWY4MTNWQTJSYXhUaFgxOWFHZTZKR0JzWC1JRmRCdUxCX2NoQXg0TzFpNmVJX2R1WjdrcC02N2FEcUc3MDhzVVhpNWQ5clU4QUdqNFdkdjFYb18xRjlZMmc5c3RDOTl0U0NiRkJLb05ZZ0RmRlVkVjFCZnpXNWFBVlRhbXVtdWs4bUMwSHZnfn4%3D&chksm=1f2c3254285bbb42bc8f76a82e9c5211518a0bb1ff8c357d085c1b78f675ef2311f3be6e282c#rd)锛� -### 渚挎嵎閮ㄧ讲鏁欑▼ +### 寮�鍙戞寚鍗� -鏂囨。涓昏閽堝灏忕櫧鐢ㄦ埛涓庡垵绾у紑鍙戣�咃紝娌℃湁淇敼銆佸畾鍒堕渶姹傦紝鏀寔浠巑odelscope涓笅杞芥ā鍨嬮儴缃诧紝涔熸敮鎸佺敤鎴穎inetune鍚庣殑妯″瀷閮ㄧ讲锛岃缁嗘暀绋嬪弬鑰冿紙[鐐瑰嚮姝ゅ](./docs/SDK_tutorial_cn.md)锛� +閫傜敤鍦烘櫙涓猴紝瀵规湇鍔¢儴缃睸DK鏈変慨鏀归渶姹傦紝閮ㄧ讲妯″瀷鏉ヨ嚜浜嶮odelScope锛屾垨鑰呯敤鎴穎inetune锛岃缁嗘枃妗e弬鑰冿紙[鐐瑰嚮姝ゅ](./docs/SDK_advanced_guide_offline_cn.md)锛� -### 楂橀樁寮�鍙戞寚鍗� - -鏂囨。涓昏閽堝楂橀樁寮�鍙戣�咃紝闇�瑕佸鏈嶅姟杩涜淇敼涓庡畾鍒讹紝鏀寔浠巑odelscope涓笅杞芥ā鍨嬮儴缃诧紝涔熸敮鎸佺敤鎴穎inetune鍚庣殑妯″瀷閮ㄧ讲锛岃缁嗘枃妗e弬鑰冿紙[鐐瑰嚮姝ゅ](./docs/SDK_advanced_guide_offline_cn.md)锛� -- Gitblit v1.9.1