From 1df10311c4e6df252db748293fd47792abae6a61 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期一, 25 三月 2024 10:16:51 +0800
Subject: [PATCH] install requirements automatically

---
 docs/tutorial/README_zh.md |  119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 108 insertions(+), 11 deletions(-)

diff --git a/docs/tutorial/README_zh.md b/docs/tutorial/README_zh.md
index 59d1303..60c3d97 100644
--- a/docs/tutorial/README_zh.md
+++ b/docs/tutorial/README_zh.md
@@ -2,11 +2,26 @@
 
 FunASR寮�婧愪簡澶ч噺鍦ㄥ伐涓氭暟鎹笂棰勮缁冩ā鍨嬶紝鎮ㄥ彲浠ュ湪 [妯″瀷璁稿彲鍗忚](https://github.com/alibaba-damo-academy/FunASR/blob/main/MODEL_LICENSE)涓嬭嚜鐢变娇鐢ㄣ�佸鍒躲�佷慨鏀瑰拰鍒嗕韩FunASR妯″瀷锛屼笅闈㈠垪涓句唬琛ㄦ�х殑妯″瀷锛屾洿澶氭ā鍨嬭鍙傝�� [妯″瀷浠撳簱](https://github.com/alibaba-damo-academy/FunASR/tree/main/model_zoo)銆�
 
+<div align="center">  
+<h4>
+ <a href="#妯″瀷鎺ㄧ悊"> 妯″瀷鎺ㄧ悊 </a>   
+锝�<a href="#妯″瀷璁粌涓庢祴璇�"> 妯″瀷璁粌涓庢祴璇� </a>
+锝�<a href="#妯″瀷瀵煎嚭涓庢祴璇�"> 妯″瀷瀵煎嚭涓庢祴璇� </a>
+</h4>
+</div>
 
-## 鎺ㄧ悊
+<a name="妯″瀷鎺ㄧ悊"></a>
+## 妯″瀷鎺ㄧ悊
 
 ### 蹇�熶娇鐢�
-#### [Paraformer 妯″瀷](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary)
+
+鍛戒护琛屾柟寮忚皟鐢細
+```shell
+funasr ++model=paraformer-zh ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=asr_example_zh.wav
+```
+
+python浠g爜璋冪敤锛堟帹鑽愶級
+
 ```python
 from funasr import AutoModel
 
@@ -50,13 +65,6 @@
 - `output_dir`: None 锛堥粯璁わ級锛屽鏋滆缃紝杈撳嚭缁撴灉鐨勮緭鍑鸿矾寰�
 - `**kwargs`(dict): 涓庢ā鍨嬬浉鍏崇殑鎺ㄧ悊鍙傛暟锛屼緥濡傦紝`beam_size=10`锛宍decoding_ctc_weight=0.1`銆�
 
-### onnx涓巐ibtorch瀵煎嚭
-
-```python
-res = model.export(type="onnx", quantize=True)
-```
-- `type`(str)锛歚onnx`(榛樿)锛屽鍑簅nnx鏍煎紡銆俙torch`瀵煎嚭libtorch鏍煎紡銆�
-- `quantize`(bool)锛歚False`锛堥粯璁わ級锛屾槸鍚﹀仛閲忓寲銆�
 
 ### 鏇村鐢ㄦ硶浠嬬粛
 
@@ -182,10 +190,18 @@
 ```
 鏇村锛圼绀轰緥](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)锛�
 
-
-## 寰皟
+<a name="鏍稿績鍔熻兘"></a>
+## 妯″瀷璁粌涓庢祴璇�
 
 ### 蹇�熷紑濮�
+
+鍛戒护琛屾墽琛岋紙鐢ㄤ簬蹇�熸祴璇曪紝涓嶆帹鑽愶級锛�
+```shell
+funasr-train ++model=paraformer-zh ++train_data_set_list=data/list/train.jsonl ++valid_data_set_list=data/list/val.jsonl ++output_dir="./outputs" &> log.txt &
+```
+
+python浠g爜鎵ц锛堝彲浠ュ鏈哄鍗★紝鎺ㄨ崘锛�
+
 ```shell
 cd examples/industrial_data_pretraining/paraformer
 bash finetune.sh
@@ -335,3 +351,84 @@
 tensorboard --logdir /xxxx/FunASR/examples/industrial_data_pretraining/paraformer/outputs/log/tensorboard
 ```
 娴忚鍣ㄤ腑鎵撳紑锛歨ttp://localhost:6006/
+
+### 璁粌鍚庢ā鍨嬫祴璇�
+
+
+#### 鏈塩onfiguration.json
+
+鍋囧畾锛岃缁冩ā鍨嬭矾寰勪负锛�./model_dir锛屽鏋滄敼鐩綍涓嬫湁鐢熸垚configuration.json锛屽彧闇�瑕佸皢 [涓婅堪妯″瀷鎺ㄧ悊鏂规硶](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/README_zh.md#%E6%A8%A1%E5%9E%8B%E6%8E%A8%E7%90%86) 涓ā鍨嬪悕瀛椾慨鏀逛负妯″瀷璺緞鍗冲彲
+
+渚嬪锛�
+
+浠巗hell鎺ㄧ悊
+```shell
+python -m funasr.bin.inference ++model="./model_dir" ++input=="${input}" ++output_dir="${output_dir}"
+```
+浠巔ython鎺ㄧ悊
+
+```python
+from funasr import AutoModel
+
+model = AutoModel(model="./model_dir")
+
+res = model.generate(input=wav_file)
+print(res)
+```
+
+#### 鏃燾onfiguration.json鏃�
+
+濡傛灉妯″瀷璺緞涓棤configuration.json鏃讹紝闇�瑕佹墜鍔ㄦ寚瀹氬叿浣撻厤缃枃浠惰矾寰勪笌妯″瀷璺緞
+
+```shell
+python -m funasr.bin.inference \
+--config-path "${local_path}" \
+--config-name "${config}" \
+++init_param="${init_param}" \
+++tokenizer_conf.token_list="${tokens}" \
+++frontend_conf.cmvn_file="${cmvn_file}" \
+++input="${input}" \
+++output_dir="${output_dir}" \
+++device="${device}"
+```
+
+鍙傛暟浠嬬粛
+- `config-path`锛氫负瀹為獙涓繚瀛樼殑 `config.yaml`锛屽彲浠ヤ粠瀹為獙杈撳嚭鐩綍涓煡鎵俱��
+- `config-name`锛氶厤缃枃浠跺悕锛屼竴鑸负 `config.yaml`锛屾敮鎸亂aml鏍煎紡涓巎son鏍煎紡锛屼緥濡� `config.json`
+- `init_param`锛氶渶瑕佹祴璇曠殑妯″瀷鍙傛暟锛屼竴鑸负`model.pt`锛屽彲浠ヨ嚜宸遍�夋嫨鍏蜂綋鐨勬ā鍨嬫枃浠�
+- `tokenizer_conf.token_list`锛氳瘝琛ㄦ枃浠惰矾寰勶紝涓�鑸湪 `config.yaml` 鏈夋寚瀹氾紝鏃犻渶鍐嶆墜鍔ㄦ寚瀹氾紝褰� `config.yaml` 涓矾寰勪笉姝g‘鏃讹紝闇�瑕佸湪姝ゅ鎵嬪姩鎸囧畾銆�
+- `frontend_conf.cmvn_file`锛歸av鎻愬彇fbank涓敤鍒扮殑cmvn鏂囦欢锛屼竴鑸湪 `config.yaml` 鏈夋寚瀹氾紝鏃犻渶鍐嶆墜鍔ㄦ寚瀹氾紝褰� `config.yaml` 涓矾寰勪笉姝g‘鏃讹紝闇�瑕佸湪姝ゅ鎵嬪姩鎸囧畾銆�
+
+鍏朵粬鍙傛暟鍚屼笂锛屽畬鏁� [绀轰緥](https://github.com/alibaba-damo-academy/FunASR/blob/main/examples/industrial_data_pretraining/paraformer/infer_from_local.sh)
+
+
+<a name="妯″瀷瀵煎嚭涓庢祴璇�"></a>
+## 妯″瀷瀵煎嚭涓庢祴璇�
+### 浠庡懡浠よ瀵煎嚭
+```shell
+funasr-export ++model=paraformer ++quantize=false
+```
+
+### 浠嶱ython瀵煎嚭
+```python
+from funasr import AutoModel
+
+model = AutoModel(model="paraformer")
+
+res = model.export(quantize=False)
+```
+
+### 娴嬭瘯ONNX
+```python
+# pip3 install -U funasr-onnx
+from funasr_onnx import Paraformer
+model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
+model = Paraformer(model_dir, batch_size=1, quantize=True)
+
+wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav']
+
+result = model(wav_path)
+print(result)
+```
+
+鏇村渚嬪瓙璇峰弬鑰� [鏍蜂緥](runtime/python/onnxruntime)
\ No newline at end of file

--
Gitblit v1.9.1