From 28ccfbfc51068a663a80764e14074df5edf2b5ba Mon Sep 17 00:00:00 2001
From: kongdeqiang <kongdeqiang960204@163.com>
Date: 星期五, 13 三月 2026 17:41:41 +0800
Subject: [PATCH] 提交

---
 docs/tutorial/Tables_zh.md |  219 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 130 insertions(+), 89 deletions(-)

diff --git a/docs/tutorial/Tables_zh.md b/docs/tutorial/Tables_zh.md
index ec64baf..72af82a 100644
--- a/docs/tutorial/Tables_zh.md
+++ b/docs/tutorial/Tables_zh.md
@@ -1,6 +1,8 @@
-# FunASR-1.x.x 娉ㄥ唽妯″瀷鏁欑▼
+# FunASR-1.x.x聽娉ㄥ唽鏂版ā鍨嬫暀绋�
 
-1.0鐗堟湰鐨勮璁″垵琛锋槸銆�**璁╂ā鍨嬮泦鎴愭洿绠�鍗�**銆戯紝鏍稿績feature涓烘敞鍐岃〃涓嶢utoModel锛�
+(绠�浣撲腑鏂噟[English](./Tables.md))
+
+funasr-1.x.x聽鐗堟湰鐨勮璁″垵琛锋槸銆�**璁╂ā鍨嬮泦鎴愭洿绠�鍗�**銆戯紝鏍稿績feature涓烘敞鍐岃〃涓嶢utoModel锛�
 
 *   娉ㄥ唽琛ㄧ殑寮曞叆锛屼娇寰楀紑鍙戜腑鍙互鐢ㄦ惌绉湪鐨勬柟寮忔帴鍏ユā鍨嬶紝鍏煎澶氱task锛�
     
@@ -11,29 +13,9 @@
 *   缁熶竴瀛︽湳涓庡伐涓氭ā鍨嬫帹鐞嗚缁冭剼鏈紱
     
 
-![image](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/a/6Ea1DxkZVte8y0g2/b78f122bd40b485687e5e13faa78ae850521.png)
-
 # 蹇�熶笂鎵�
 
 ## 鍩轰簬automodel鐢ㄦ硶
-
-### Paraformer妯″瀷
-
-杈撳叆浠绘剰鏃堕暱璇煶锛岃緭鍑轰负璇煶鍐呭瀵瑰簲鏂囧瓧锛屾枃瀛楀叿鏈夋爣鐐规柇鍙ワ紝瀛楃骇鍒椂闂存埑锛屼互鍙婅璇濅汉韬唤銆�
-
-```python
-from funasr import AutoModel
-
-model = AutoModel(model="paraformer-zh",  
-                  vad_model="fsmn-vad", 
-                  vad_kwargs={"max_single_segment_time": 60000},
-                  punc_model="ct-punc", 
-                  # spk_model="cam++"
-                  )
-wav_file = f"{model.model_path}/example/asr_example.wav"
-res = model.generate(input=wav_file, batch_size_s=300, batch_size_threshold_s=60, hotword='榄旀惌')
-print(res)
-```
 
 ### SenseVoiceSmall妯″瀷
 
@@ -89,14 +71,14 @@
 res = model.generate(input=[str], output_dir=[str])
 ```
 
-*   wav鏂囦欢璺緞,聽渚嬪:聽asr\_example.wav
-    
-*   pcm鏂囦欢璺緞,聽渚嬪:聽asr\_example.pcm锛屾鏃堕渶瑕佹寚瀹氶煶棰戦噰鏍风巼fs锛堥粯璁や负16000锛�
-    
-*   闊抽瀛楄妭鏁版祦锛屼緥濡傦細楹﹀厠椋庣殑瀛楄妭鏁版暟鎹�
-    
-*   wav.scp锛宬aldi聽鏍峰紡鐨劼爓av聽鍒楄〃聽(`wav_id聽\t聽wav_path`),聽渚嬪:
-    
+*   *   wav鏂囦欢璺緞,聽渚嬪:聽asr\_example.wav
+        
+    *   pcm鏂囦欢璺緞,聽渚嬪:聽asr\_example.pcm锛屾鏃堕渶瑕佹寚瀹氶煶棰戦噰鏍风巼fs锛堥粯璁や负16000锛�
+        
+    *   闊抽瀛楄妭鏁版祦锛屼緥濡傦細楹﹀厠椋庣殑瀛楄妭鏁版暟鎹�
+        
+    *   wav.scp锛宬aldi聽鏍峰紡鐨劼爓av聽鍒楄〃聽(`wav_id聽\t聽wav_path`),聽渚嬪:
+        
 
 ```plaintext
 asr_example1  ./audios/asr_example1.wav
@@ -119,78 +101,88 @@
 
 # 娉ㄥ唽琛ㄨ瑙�
 
+浠enseVoiceSmall妯″瀷涓轰緥锛岃瑙e浣曟敞鍐屾柊妯″瀷锛屾ā鍨嬮摼鎺ワ細
+
+**modelscope锛�**[https://www.modelscope.cn/models/iic/SenseVoiceSmall/files](https://www.modelscope.cn/models/iic/SenseVoiceSmall/files)
+
+**huggingface锛�**[https://huggingface.co/FunAudioLLM/SenseVoiceSmall](https://huggingface.co/FunAudioLLM/SenseVoiceSmall)
+
 ## 妯″瀷璧勬簮鐩綍
 
-![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/8oLl9y628rBNlapY/img/f16961f1-bdfb-4638-83d5-e4cb13a5a4a4.png)
+![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/8oLl9y628rBNlapY/img/cab7f215-787f-4407-885a-14dc89ae9e02.png)
 
 **閰嶇疆鏂囦欢**锛歝onfig.yaml
 
 ```yaml
-model: SenseVoiceLarge
-model_conf:
-  lsm_weight: 0.1
-  length_normalized_loss: true
-  activation_checkpoint: true
-  sos: <|startoftranscript|>
-  eos: <|endoftext|>
-  downsample_rate: 4
-  use_padmask: true
-
-encoder: SenseVoiceEncoder
+encoder: SenseVoiceEncoderSmall
 encoder_conf:
-  input_size: 128
-  attention_heads: 20
-  linear_units: 1280
-  num_blocks: 32
-  dropout_rate: 0.1
-  positional_dropout_rate: 0.1
-  attention_dropout_rate: 0.1
-  kernel_size: 31
-  sanm_shfit: 0
-  att_type: self_att_fsmn_sdpa
-  downsample_rate: 4
-  use_padmask: true
-  max_position_embeddings: 2048
-  rope_theta: 10000
-  
-frontend: WhisperFrontend
-frontend_conf:
-  fs: 16000
-  n_mels: 128
-  do_pad_trim: false
-  filters_path: null
+    output_size: 512
+    attention_heads: 4
+    linear_units: 2048
+    num_blocks: 50
+    tp_blocks: 20
+    dropout_rate: 0.1
+    positional_dropout_rate: 0.1
+    attention_dropout_rate: 0.1
+    input_layer: pe
+    pos_enc_class: SinusoidalPositionEncoder
+    normalize_before: true
+    kernel_size: 11
+    sanm_shfit: 0
+    selfattention_layer_type: sanm
 
-tokenizer: SenseVoiceTokenizer
+
+model: SenseVoiceSmall
+model_conf:
+    length_normalized_loss: true
+    sos: 1
+    eos: 2
+    ignore_id: -1
+
+tokenizer: SentencepiecesTokenizer
 tokenizer_conf:
-  vocab_path: null
-  is_multilingual: true
-  num_languages: 8749
+  bpemodel: null
+  unk_symbol: <unk>
+  split_with_space: true
 
-dataset: SenseVoiceDataset
+frontend: WavFrontend
+frontend_conf:
+    fs: 16000
+    window: hamming
+    n_mels: 80
+    frame_length: 25
+    frame_shift: 10
+    lfr_m: 7
+    lfr_n: 6
+    cmvn_file: null
+
+
+dataset: SenseVoiceCTCDataset
 dataset_conf:
   index_ds: IndexDSJsonl
-  batch_sampler: BatchSampler
+  batch_sampler: EspnetStyleBatchSampler
+  data_split_num: 32
   batch_type: token
-  batch_size: 12000
-  sort_size: 64
+  batch_size: 14000
   max_token_length: 2000
   min_token_length: 60
   max_source_length: 2000
   min_source_length: 60
-  max_target_length: 150
+  max_target_length: 200
   min_target_length: 0
   shuffle: true
   num_workers: 4
   sos: ${model_conf.sos}
   eos: ${model_conf.eos}
   IndexDSJsonl: IndexDSJsonl
+  retry: 20
 
 train_conf:
   accum_grad: 1
   grad_clip: 5
-  max_epoch: 5
-  keep_nbest_models: 200
-  avg_nbest_model: 200
+  max_epoch: 20
+  keep_nbest_models: 10
+  avg_nbest_model: 10
   log_interval: 100
   resume: true
   validate_interval: 10000
@@ -198,17 +190,16 @@
 
 optim: adamw
 optim_conf:
-  lr: 2.5e-05
-
+  lr: 0.00002
 scheduler: warmuplr
 scheduler_conf:
-  warmup_steps: 20000
+  warmup_steps: 25000
 
 ```
 
 **妯″瀷鍙傛暟**锛歮odel.pt
 
-**璺緞瑙f瀽**锛歝onfiguration.json
+**璺緞瑙f瀽**锛歝onfiguration.json锛堥潪蹇呴渶锛�
 
 ```json
 {
@@ -222,31 +213,61 @@
   "file_path_metas": {
     "init_param":"model.pt", 
     "config":"config.yaml",
-    "tokenizer_conf": {"vocab_path": "tokens.tiktoken"},
-    "frontend_conf":{"filters_path": "mel_filters.npz"}}
+    "tokenizer_conf": {"bpemodel": "chn_jpn_yue_eng_ko_spectok.bpe.model"},
+    "frontend_conf":{"cmvn_file": "am.mvn"}}
 }
+```
+
+configuration.json鐨勪綔鐢ㄦ槸缁檉ile\_path\_metas涓殑item鎷兼帴涓婃ā鍨嬫牴鐩綍锛屼互渚夸簬璺緞鑳藉琚纭殑瑙f瀽锛屼互涓婁负渚嬶紝鍋囪妯″瀷鏍圭洰褰曚负锛�/home/zhifu.gzf/init\_model/SenseVoiceSmall锛岀洰褰曚腑config.yaml涓殑鐩稿叧璺緞琚浛鎹㈡垚浜嗘纭殑璺緞锛堝拷鐣ユ棤鍏抽厤缃級锛�
+
+```yaml
+init_param: /home/zhifu.gzf/init_model/SenseVoiceSmall/model.pt
+
+tokenizer_conf:
+  bpemodel: /home/zhifu.gzf/init_model/SenseVoiceSmall/chn_jpn_yue_eng_ko_spectok.bpe.model
+
+frontend_conf:
+    cmvn_file: /home/zhifu.gzf/init_model/SenseVoiceSmall/am.mvn
 ```
 
 ## 娉ㄥ唽琛�
 
+![image](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/a/6Ea1DxkZVte8y0g2/c92059e82c38493988fbc8c032d3f5380521.png)
+
 ### 鏌ョ湅娉ㄥ唽琛�
 
-```python
+```plaintext
 from funasr.register import tables
 
 tables.print()
 ```
 
-鏀寔鏌ョ湅鎸囧畾绫诲瀷鐨勬敞鍐岃〃锛歚tables.print("model")`
+鏀寔鏌ョ湅鎸囧畾绫诲瀷鐨勬敞鍐岃〃锛歕`tables.print("model")\`锛岀洰鍓峟unasr宸茬粡娉ㄥ唽妯″瀷濡備笂鍥炬墍绀恒�傜洰鍓嶉鍏堝畾涔変簡濡備笅鍑犱釜鍒嗙被锛�
 
+```python
+    model_classes = {}
+    frontend_classes = {}
+    specaug_classes = {}
+    normalize_classes = {}
+    encoder_classes = {}
+    decoder_classes = {}
+    joint_network_classes = {}
+    predictor_classes = {}
+    stride_conv_classes = {}
+    tokenizer_classes = {}
+    dataloader_classes = {}
+    batch_sampler_classes = {}
+    dataset_classes = {}
+    index_ds_classes = {}
+```
 
-### 鏂版敞鍐�
+### 娉ㄥ唽妯″瀷
 
 ```python
 from funasr.register import tables
 
-@tables.register("model_classes", "MinMo_S2T")
-class MinMo_S2T(nn.Module):
+@tables.register("model_classes", "SenseVoiceSmall")
+class SenseVoiceSmall(nn.Module):
   def __init__(*args, **kwargs):
     ...
 
@@ -268,14 +289,34 @@
 
 ```
 
-鍦╟onfig.yaml涓寚瀹氭柊娉ㄥ唽妯″瀷
+鍦ㄩ渶瑕佹敞鍐岀殑绫诲悕鍓嶅姞涓娐燖tables.register("model\_classes",聽"SenseVoiceSmall")锛屽嵆鍙畬鎴愭敞鍐岋紝绫婚渶瑕佸疄鐜版湁锛歕_\_init\_\_锛宖orward锛宨nference鏂规硶銆�
 
-```yaml
-model: MinMo_S2T
+register鐢ㄦ硶锛�
+
+```python
+@tables.register("娉ㄥ唽鍒嗙被", "娉ㄥ唽鍚�")
+```
+
+鍏朵腑锛�"娉ㄥ唽鍒嗙被"鍙互鏄鍏堝畾涔夊ソ鐨勫垎绫伙紙瑙佷笂闈㈠浘锛夛紝濡傛灉鏄嚜宸卞畾涔夌殑鏂板垎绫伙紝浼氳嚜鍔ㄥ皢鏂板垎绫诲啓杩涙敞鍐岃〃鍒嗙被涓紝"娉ㄥ唽鍚�"鍗冲笇鏈涙敞鍐屽悕瀛楋紝鍚庣画鍙互鐩存帴鏉ヤ娇鐢ㄣ��
+
+瀹屾暣浠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:
   ...
 ```
 
+### 娉ㄥ唽澶辫触
+
+濡傛灉鍑虹幇鎵句笉鍒版敞鍐屾ā鍨嬫垨鍙戞柟娉曪紝assert聽model\_class聽is聽not聽None,聽f'{kwargs\["model"\]}聽is聽not聽registered'銆傛ā鍨嬫敞鍐岀殑鍘熺悊鏄紝import聽妯″瀷鏂囦欢锛屽彲浠ラ�氳繃import鏉ユ煡鐪嬪叿浣撴敞鍐屽け璐ュ師鍥狅紝渚嬪锛屼笂杩版ā鍨嬫枃浠朵负锛宖unasr/models/sense\_voice/model.py锛�
+
+```python
+from funasr.models.sense_voice.model import *
+```
+
 ## 娉ㄥ唽鍘熷垯
 
 *   Model锛氭ā鍨嬩箣闂翠簰鐩哥嫭绔嬶紝姣忎竴涓ā鍨嬶紝閮介渶瑕佸湪funasr/models/涓嬮潰鏂板缓涓�涓ā鍨嬬洰褰曪紝涓嶈閲囩敤绫荤殑缁ф壙鏂规硶锛侊紒锛佷笉瑕佷粠鍏朵粬妯″瀷鐩綍涓璱mport锛屾墍鏈夐渶瑕佺敤鍒扮殑閮藉崟鐙斁鍒拌嚜宸辩殑妯″瀷鐩綍涓紒锛侊紒涓嶈淇敼鐜版湁鐨勬ā鍨嬩唬鐮侊紒锛侊紒

--
Gitblit v1.9.1