From 23e7ddebccd3b05cf7ef89809bcfe565ad6dfa1f Mon Sep 17 00:00:00 2001
From: majic31 <majic31@163.com>
Date: 星期二, 24 十二月 2024 10:00:14 +0800
Subject: [PATCH] Fix the variable name (#2328)
---
docs/tutorial/README_zh.md | 74 ++++++++++++++++++++++++++++++++++--
1 files changed, 69 insertions(+), 5 deletions(-)
diff --git a/docs/tutorial/README_zh.md b/docs/tutorial/README_zh.md
index 78acb58..5bf15f0 100644
--- a/docs/tutorial/README_zh.md
+++ b/docs/tutorial/README_zh.md
@@ -7,6 +7,7 @@
<a href="#妯″瀷鎺ㄧ悊"> 妯″瀷鎺ㄧ悊 </a>
锝�<a href="#妯″瀷璁粌涓庢祴璇�"> 妯″瀷璁粌涓庢祴璇� </a>
锝�<a href="#妯″瀷瀵煎嚭涓庢祴璇�"> 妯″瀷瀵煎嚭涓庢祴璇� </a>
+锝�<a href="#鏂版ā鍨嬫敞鍐屾暀绋�"> 鏂版ā鍨嬫敞鍐屾暀绋� </a>
</h4>
</div>
@@ -131,7 +132,7 @@
model = AutoModel(model="fsmn-vad")
-wav_file = f"{model.model_path}/example/asr_example.wav"
+wav_file = f"{model.model_path}/example/vad_example.wav"
res = model.generate(input=wav_file)
print(res)
```
@@ -268,7 +269,7 @@
export CUDA_VISIBLE_DEVICES="0,1"
gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}')
-torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr=192.168.1.1 --master_port=12345 \
+torchrun --nnodes 2 --node_rank 0 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \
../../../funasr/bin/train.py ${train_args}
```
鍦ㄤ粠鑺傜偣涓婏紙鍋囪IP涓�192.168.1.2锛夛紝浣犻渶瑕佺‘淇滿ASTER_ADDR鍜孧ASTER_PORT鐜鍙橀噺涓庝富鑺傜偣璁剧疆鐨勪竴鑷达紝骞惰繍琛屽悓鏍风殑鍛戒护锛�
@@ -276,7 +277,7 @@
export CUDA_VISIBLE_DEVICES="0,1"
gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}')
-torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr=192.168.1.1 --master_port=12345 \
+torchrun --nnodes 2 --node_rank 1 --nproc_per_node ${gpu_num} --master_addr 192.168.1.1 --master_port 12345 \
../../../funasr/bin/train.py ${train_args}
```
@@ -359,7 +360,7 @@
#### 鏈塩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) 涓ā鍨嬪悕瀛椾慨鏀逛负妯″瀷璺緞鍗冲彲
+鍋囧畾锛岃缁冩ā鍨嬭矾寰勪负锛�./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) 涓ā鍨嬪悕瀛椾慨鏀逛负妯″瀷璺緞鍗冲彲
渚嬪锛�
@@ -420,6 +421,12 @@
res = model.export(quantize=False)
```
+### 浼樺寲onnx
+```shell
+# pip3 install -U onnxslim
+onnxslim model.onnx model.onnx
+```
+
### 娴嬭瘯ONNX
```python
# pip3 install -U funasr-onnx
@@ -433,4 +440,61 @@
print(result)
```
-鏇村渚嬪瓙璇峰弬鑰� [鏍蜂緥](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime)
\ No newline at end of file
+鏇村渚嬪瓙璇峰弬鑰� [鏍蜂緥](https://github.com/alibaba-damo-academy/FunASR/tree/main/runtime/python/onnxruntime)
+
+<a name="鏂版ā鍨嬫敞鍐屾暀绋�"></a>
+## 鏂版ā鍨嬫敞鍐屾暀绋�
+
+
+### 鏌ョ湅娉ㄥ唽琛�
+
+```plaintext
+from funasr.register import tables
+
+tables.print()
+```
+
+鏀寔鏌ョ湅鎸囧畾绫诲瀷鐨勬敞鍐岃〃锛歕`tables.print("model")\`
+
+### 娉ㄥ唽妯″瀷
+
+```python
+from funasr.register import tables
+
+@tables.register("model_classes", "SenseVoiceSmall")
+class SenseVoiceSmall(nn.Module):
+ def __init__(*args, **kwargs):
+ ...
+
+ def forward(
+ self,
+ **kwargs,
+ ):
+
+ def inference(
+ self,
+ data_in,
+ data_lengths=None,
+ key: list = None,
+ tokenizer=None,
+ frontend=None,
+ **kwargs,
+ ):
+ ...
+
+```
+
+鍦ㄩ渶瑕佹敞鍐岀殑绫诲悕鍓嶅姞涓� `@tables.register("model_classes","SenseVoiceSmall")`锛屽嵆鍙畬鎴愭敞鍐岋紝绫婚渶瑕佸疄鐜版湁锛歘_init__锛宖orward锛宨nference鏂规硶銆�
+
+瀹屾暣浠g爜锛歔https://github.com/modelscope/FunASR/blob/main/funasr/models/sense\_voice/model.py#L443](https://github.com/modelscope/FunASR/blob/main/funasr/models/sense_voice/model.py#L443)
+
+娉ㄥ唽瀹屾垚鍚庯紝鍦╟onfig.yaml涓寚瀹氭柊娉ㄥ唽妯″瀷锛屽嵆鍙疄鐜板妯″瀷鐨勫畾涔�
+
+```python
+model: SenseVoiceSmall
+model_conf:
+ ...
+```
+
+
+[鏇村璇︾粏鏁欑▼鏂囨。](https://github.com/modelscope/FunASR/blob/main/docs/tutorial/Tables_zh.md)
\ No newline at end of file
--
Gitblit v1.9.1