DataoceanAI commited on
Commit
77fed91
·
verified ·
1 Parent(s): e627d7d

upload model

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ dolphin_fangyan_feature_poster_v3.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,222 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ license: apache-2.0
4
+
5
+ language:
6
+
7
+ - zh
8
+
9
+ tags:
10
+
11
+ - speech
12
+
13
+ - asr
14
+
15
+ frameworks:
16
+
17
+ - pytorch
18
+
19
+ ---
20
+
21
+ # Dolphin-Fangyan
22
+
23
+ [Paper](https://arxiv.org/abs/2503.20212)
24
+ [Github](https://github.com/DataoceanAI/Dolphin)
25
+ [Huggingface](https://huggingface.co/DataoceanAI)
26
+ [Modelscope](https://www.modelscope.cn/organization/DataoceanAI)
27
+ [Openi](https://openi.pcl.ac.cn/DataoceanAI/Dolphin)
28
+ [Wisemodel](https://wisemodel.cn/models/lijp22/dolphin-base)
29
+
30
+ **Dolphin-Fangyan** is a multi-dialect ASR model developed by Dataocean AI and Tsinghua University, with a strong focus on Chinese dialect recognition and real-world deployment scenarios. Compared with the previous Dolphin series, Dolphin-Fangyan introduces significant improvements in tokenizer design, dialect-balanced training, streaming capability, hotword biasing, and deployment efficiency.
31
+
32
+ The model supports Mandarin Chinese and 22 Chinese dialects, while also maintaining multilingual ASR capability inherited from Dolphin. Dolphin-Fangyan supports both streaming and non-streaming inference, enabling practical deployment in latency-sensitive applications such as real-time transcription and industrial speech recognition systems.
33
+
34
+
35
+ ## Approach
36
+
37
+ Dolphin-Fangyan is built upon the Dolphin architecture and follows a joint CTC-Attention framework with:
38
+
39
+ * Encoder: E-Branchformer
40
+ * Decoder: Transformer Decoder
41
+ * Training Objective: Joint CTC + Attention loss
42
+
43
+ Compared to Dolphin, Dolphin-Fangyan introduces several important improvements:
44
+
45
+ * Temperature-based data sampling for balancing standard Mandarin and low-resource dialects
46
+ * Redesigned tokenizer with:
47
+ * character-level modeling for Chinese
48
+ * BPE-based subword modeling for English
49
+ * extensible dialect tokens
50
+ * Streaming ASR support
51
+ * Hotword-biased decoding, including:
52
+ * encoder-level contextual biasing
53
+ * prompt-based decoder biasing
54
+
55
+ Experimental results show that Dolphin-Fangyan achieves:
56
+
57
+ * 38% improvement in dialect recognition accuracy
58
+ * 16.3% relative CER reduction over Dolphin
59
+ * Competitive performance with recent large-scale ASR systems while maintaining a smaller model size
60
+
61
+ ![Dolphin-FangYan 特色海报](dolphin_fangyan_feature_poster_v3.png)
62
+
63
+
64
+ See details in the [Paper](https://arxiv.org/abs/2503.20212).
65
+
66
+
67
+ ## Setup
68
+
69
+ Dolphin-Fangyan requires FFmpeg to convert audio files into WAV format. Please install FFmpeg first if it is not already installed on your system.
70
+
71
+ ```shell
72
+ # Ubuntu / Debian
73
+ sudo apt update && sudo apt install ffmpeg
74
+ # MacOS
75
+ brew install ffmpeg
76
+ # Windows
77
+ choco install ffmpeg
78
+ ```
79
+
80
+ Install Dolphin with pip:
81
+
82
+ ```shell
83
+ pip install -U dolphin
84
+ ```
85
+
86
+ Alternatively, install from source:
87
+
88
+ ```shell
89
+ pip install git+https://github.com/DataoceanAI/Dolphin.git
90
+ ```
91
+
92
+ ## Available Models
93
+
94
+ Currently, Dolphin-Fangyan provides multiple model sizes optimized for different deployment scenarios.
95
+
96
+ | Model | Parameters | Hotwords |
97
+ |:------:|:----------:|:----------:|
98
+ | base.fangyan | 0.1 B | ❌ |
99
+ | base.fangyan.streaming | 0.1 B |❌ |
100
+ | small.fangyan | 0.4 B | Encoder-biased Hotwords |
101
+ | small.fangyan.streaming | 0.4 B | Encoder-biased Hotwords |
102
+ | small.fangyan.prompt | 0.4 B | Prompt-based Hotwords |
103
+
104
+
105
+ ## Hotword Biasing
106
+
107
+ Dolphin-Fangyan supports two hotword biasing approaches.
108
+
109
+ **Encoder-Level Contextual Biasing**
110
+
111
+ * Supports both streaming and non-streaming models
112
+ * Integrates contextual embeddings into encoder representations
113
+ * Efficient adaptation without retraining the full model
114
+
115
+ **Prompt-Based Hotword Biasing**
116
+
117
+ * Designed for non-streaming models
118
+ * Injects hotwords directly into decoder prompts
119
+ * Particularly effective for long-tail and rare phrases
120
+
121
+ Experimental results show significant reductions in hotword error rates while maintaining strong overall ASR performance.
122
+
123
+
124
+
125
+ ## Supported Languages and Dialects
126
+
127
+ Dolphin-Fangyan primarily focuses on:
128
+
129
+ * Mandarin Chinese
130
+ * 22 Chinese dialects
131
+ * Regional accented Mandarin
132
+
133
+ Supported dialects include:
134
+
135
+ * Sichuan
136
+ * Wu
137
+ * Minnan
138
+ * Shanghai
139
+ * Gansu
140
+ * Guangdong
141
+ * Wenzhou
142
+ * Hunan
143
+ * Anhui
144
+ * Henan
145
+ * Fujian
146
+ * Hebei
147
+ * Liaoning
148
+ * Shaanxi
149
+ * Tianjin
150
+ * and more
151
+
152
+ For the complete language and dialect list, see [languages.md](./languages.md).
153
+
154
+ ## Supported Devices
155
+
156
+ | Device Type | Support Status |
157
+ |:-------------:|:----------------:|
158
+ |**CUDA**|✅Supported|
159
+ |**MPS (Apple)**|✅Supported|
160
+ |**Ascend NPU (Huawei)**|✅Supported|
161
+ |**CPU**|✅Supported|
162
+
163
+ To run Dolphin on Ascend NPU, you need to install the corresponding `torch_npu` package and configure the environment `ASCEND_RT_VISIBLE_DEVICES`. The tested configuration is: `CANN==8.0.1`, `torch==2.2.0`, `torch_npu==2.2.0`. With this setup, the model has been verified to run inference correctly on the Ascend NPU.
164
+
165
+
166
+
167
+ ## Usage
168
+
169
+ ### Command-line usage
170
+
171
+ ```shell
172
+ dolphin audio.wav
173
+
174
+ # Download model and specify the model path
175
+ dolphin audio.wav --model small.fangyan --model_dir /data/models/dolphin/
176
+
177
+ # Specify language and region
178
+ dolphin audio.wav --model small.fangyan --model_dir /data/models/dolphin/ --lang_sym "zh" --region_sym "CN"
179
+
180
+ # Specify the hotwords file with Encoder-biased method
181
+ dolphin audio.wav --model small.fangyan --model_dir /data/models/dolphin/ --hotword_list_path hotwords.txt --use_deep_biasing true
182
+
183
+ # Using prompt-based model
184
+ dolphin audio.wav --model small.fangyan.prompt --model_dir /data/models/dolphin/ --hotword_list_path hotwords.txt --use_prompt_hotword true --use_two_stage_filter true
185
+
186
+ ```
187
+
188
+ ### Python usage
189
+
190
+ ```python
191
+ import dolphin
192
+ from dolphin import transcribe
193
+
194
+ model_name = 'small.fangyan'
195
+ model = dolphin.load_model(model_name, f"/data/models/dolphin/{model_name}", "cuda")
196
+
197
+ result = transcribe(model, 'audio.wav')
198
+ print(result.text)
199
+
200
+ # Specify language
201
+ result = transcribe(model, 'audio.wav', lang_sym="zh")
202
+ print(result.text)
203
+
204
+ # Specify language and region and encoder-biased hotwords
205
+ result = transcribe(model, 'audio.wav', lang_sym="zh", region_sym="CN", hotwords=['诺香丹青牌科研胶囊'], use_deep_biasing=True, use_two_stage_filter=True)
206
+ print(result.text)
207
+
208
+ ## prompt-based hotwords
209
+
210
+ model_name = 'small.fangyan.prompt'
211
+ model = dolphin.load_model(model_name, f"/data/models/dolphin/{model_name}", "cuda")
212
+
213
+ result = transcribe(model, 'audio.wav', hotwords=['诺香丹青牌科研胶囊'], use_prompt_hotword=True, use_two_stage_filter=True, decoding_method='attention')
214
+
215
+ print(result.text)
216
+
217
+ ```
218
+
219
+
220
+ ## License
221
+
222
+ Dolphin-Fangyan is released under the Apache 2.0 License.
base.fangyan.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c7a746c225f0f406053c9ebbdced7b79cfb91051d8060da3f1a26aa7913648b
3
+ size 447175723
dolphin_fangyan_feature_poster_v3.png ADDED

Git LFS Details

  • SHA256: fd337571c3573b3aeff3891045074b2efe3a98017452e9fdd8fcfd986bb2c884
  • Pointer size: 131 Bytes
  • Size of remote file: 587 kB
global_cmvn ADDED
@@ -0,0 +1 @@
 
 
1
+ {"mean_stat": [533749120.0, 537379776.0, 553561472.0, 587164544.0, 631869696.0, 662598848.0, 684377024.0, 695393728.0, 692471168.0, 679433984.0, 666123200.0, 656323712.0, 665752576.0, 678693440.0, 681920896.0, 679622080.0, 669891840.0, 656595136.0, 653838528.0, 637679232.0, 628412096.0, 644836864.0, 638840960.0, 646180608.0, 639724352.0, 642756992.0, 637471744.0, 642369856.0, 643414976.0, 647382848.0, 649348672.0, 649294336.0, 650233920.0, 654485056.0, 660473792.0, 667416512.0, 673158464.0, 675675200.0, 675123648.0, 668017536.0, 670060160.0, 662626240.0, 663143808.0, 662504064.0, 666413696.0, 672262080.0, 678483904.0, 685386048.0, 692572416.0, 699064000.0, 700785280.0, 701202688.0, 702666560.0, 705441664.0, 706070720.0, 705989248.0, 702842816.0, 699316416.0, 696090176.0, 687561152.0, 675279808.0, 663676352.0, 662962880.0, 664298944.0, 666095808.0, 671681664.0, 676652224.0, 680097152.0, 683811072.0, 688700992.0, 692082880.0, 695787904.0, 701085376.0, 706388736.0, 711491584.0, 717637248.0, 719691456.0, 715812736.0, 696362624.0, 604648448.0], "var_stat": [5413307392.0, 5559845888.0, 6150984704.0, 6921248256.0, 7999779840.0, 8789867520.0, 9405782016.0, 9768041472.0, 9759789056.0, 9430661120.0, 9090545664.0, 8873148416.0, 9155918848.0, 9542536192.0, 9653540864.0, 9593434112.0, 9316643840.0, 8959277056.0, 8863545344.0, 8450634752.0, 8211585536.0, 8587086336.0, 8432618496.0, 8583947264.0, 8401719808.0, 8439344640.0, 8293782528.0, 8401505280.0, 8427503104.0, 8525163520.0, 8577082880.0, 8575110656.0, 8594999296.0, 8701685760.0, 8854966272.0, 9029483520.0, 9168757760.0, 9221463040.0, 9194539008.0, 8997074944.0, 9024589824.0, 8819394560.0, 8807888896.0, 8777241600.0, 8869670912.0, 9017397248.0, 9173403648.0, 9345572864.0, 9530641408.0, 9701232640.0, 9748996096.0, 9762760704.0, 9801994240.0, 9874428928.0, 9883272192.0, 9873506304.0, 9780680704.0, 9672627200.0, 9569440768.0, 9321866240.0, 8968148992.0, 8646342656.0, 8616977408.0, 8648623104.0, 8702088192.0, 8859208704.0, 8999405568.0, 9105936384.0, 9220425728.0, 9358615552.0, 9451428864.0, 9552728064.0, 9695461376.0, 9836660736.0, 9970957312.0, 10135880704.0, 10189387776.0, 10070480896.0, 9532967936.0, 7261238272.0], "frame_num": 54068199}
train.yaml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ accum_grad: 4
2
+ cmvn: global_cmvn
3
+ cmvn_conf:
4
+ cmvn_file: data/train/global_cmvn
5
+ is_json_cmvn: true
6
+ ctc: ctc
7
+ ctc_conf:
8
+ ctc_blank_id: 0
9
+ dataset: asr
10
+ dataset_conf:
11
+ batch_conf:
12
+ batch_size: 32
13
+ batch_type: static
14
+ ctc_label: true
15
+ cycle: 100
16
+ fbank_conf:
17
+ dither: 0.1
18
+ frame_length: 25
19
+ frame_shift: 10
20
+ num_mel_bins: 80
21
+ filter_conf:
22
+ max_length: 3000
23
+ min_length: 0
24
+ token_max_length: 200
25
+ token_min_length: 1
26
+ no_time_idx: 3
27
+ remove_punctuation: true
28
+ remove_timestamp: true
29
+ resample_conf:
30
+ resample_rate: 16000
31
+ shuffle: true
32
+ shuffle_conf:
33
+ shuffle_size: 5120
34
+ sort: true
35
+ sort_conf:
36
+ sort_size: 2048
37
+ spec_aug: true
38
+ spec_aug_conf:
39
+ max_f: 10
40
+ max_t: 50
41
+ num_f_mask: 2
42
+ num_t_mask: 2
43
+ speed_perturb: true
44
+ time_apply_prob: 0.0
45
+ decoder: transformer
46
+ decoder_conf:
47
+ attention_heads: 8
48
+ dropout_rate: 0.1
49
+ linear_units: 2048
50
+ num_blocks: 6
51
+ positional_dropout_rate: 0.1
52
+ self_attention_dropout_rate: 0.1
53
+ src_attention_dropout_rate: 0.1
54
+ use_sdpa: true
55
+ dtype: fp32
56
+ encoder: e_branchformer
57
+ encoder_conf:
58
+ activation_type: swish
59
+ attention_dropout_rate: 0.1
60
+ attention_heads: 8
61
+ causal: false
62
+ cgmlp_conv_kernel: 31
63
+ cgmlp_linear_units: 2048
64
+ dropout_rate: 0.1
65
+ gate_activation: identity
66
+ input_layer: conv2d
67
+ linear_units: 2048
68
+ merge_conv_kernel: 31
69
+ num_blocks: 6
70
+ output_size: 512
71
+ pos_enc_layer_type: rel_pos
72
+ positional_dropout_rate: 0.1
73
+ selfattention_layer_type: rel_selfattn
74
+ use_linear_after_conv: false
75
+ use_sdpa: true
76
+ grad_clip: 5
77
+ input_dim: 80
78
+ log_interval: 200
79
+ max_epoch: 100
80
+ model: asr_model
81
+ model_conf:
82
+ ctc_weight: 0.3
83
+ length_normalized_loss: false
84
+ lsm_weight: 0.1
85
+ model_dir: exp/dolphin_ebf_base_nonstreaming_v4.3
86
+ optim: adam
87
+ optim_conf:
88
+ lr: 0.0005
89
+ output_dim: 18173
90
+ save_interval: 2000
91
+ save_states: model_only
92
+ scheduler: warmuplr
93
+ scheduler_conf:
94
+ warmup_steps: 2048
95
+ stats_dialect: true
96
+ tokenizer: char
97
+ tokenizer_conf:
98
+ special_tokens:
99
+ <asr>: 4
100
+ <blank>: 0
101
+ <eos>: 3
102
+ <sos>: 2
103
+ <unk>: 1
104
+ split_with_space: false
105
+ symbol_table_path: data/dict/units.txt
106
+ train_engine: torch_ddp
107
+ use_amp: false
108
+ vocab_size: 18173
units.txt ADDED
The diff for this file is too large to render. See raw diff