Wendy9805 commited on
Commit
93a3148
·
verified ·
1 Parent(s): 6f0d3ac

docs: update arXiv link to 2605.19266

Browse files
Files changed (1) hide show
  1. README.md +194 -49
README.md CHANGED
@@ -1,49 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- license: apache-2.0
3
- language:
4
- - zh
5
- tags:
6
- - automatic-speech-recognition
7
- - audio
8
- - qwen3
9
- - asr
10
- - speech
11
- pipeline_tag: automatic-speech-recognition
12
- model-index:
13
- - name: FormalASR-1.7B
14
- results: []
15
  ---
16
 
17
- # FormalASR-1.7B
18
 
19
- FormalASR-1.7B is a fine-tuned ASR (Automatic Speech Recognition) model based on [Qwen3-ASR-1.7B](https://huggingface.co/Qwen/Qwen3-ASR-1.7B), specifically optimized for **formal/written-style transcription** — outputting clean, punctuated, written-form text rather than colloquial spoken transcripts.
20
 
21
- ## Model Description
 
 
 
 
 
 
22
 
23
- | Attribute | Value |
24
- |---|---|
25
- | Architecture | Qwen3ASRForConditionalGeneration |
26
- | Base Model | Qwen3-ASR-1.7B |
27
- | Parameters | ~1.7B |
28
- | Dtype | bfloat16 |
29
- | Audio Encoder | Whisper-like (24 layers, d_model=1024) |
30
- | Text Decoder | Qwen3 (28 layers, hidden=2048) |
31
 
32
- ## Key Features
 
 
 
 
 
 
33
 
34
- - 🎯 **Written-style output**: Produces formal, punctuated text suitable for documentation, subtitles, and professional use
35
- - 🚀 **Higher accuracy**: 1.7B parameter model offers improved recognition over the 0.6B variant
36
- - 🔊 **Long-form audio**: Supports up to 800 windows (~160 seconds) inference
37
 
38
- ## Usage
39
 
40
- ### Installation
 
 
 
 
 
 
41
 
42
  ```bash
43
  pip install -U qwen-asr
44
  ```
45
 
46
- ### HuggingFace
47
 
48
  ```python
49
  import torch
@@ -71,7 +133,6 @@ import torch
71
  from modelscope import snapshot_download
72
  from qwen_asr import Qwen3ASRModel
73
 
74
- # 下载模型到本地(首次运行自动下载)
75
  model_dir = snapshot_download("TaurenMountain/FormalASR-1.7B")
76
 
77
  model = Qwen3ASRModel.from_pretrained(
@@ -89,32 +150,116 @@ results = model.transcribe(
89
  print(results[0].text)
90
  ```
91
 
92
- ## Training Details
93
 
94
- This model is fine-tuned from Qwen3-ASR-1.7B on a curated dataset of formal speech paired with written-style transcriptions. The fine-tuning process focuses on:
95
 
96
- - Converting spoken language patterns to formal written text
97
- - Proper punctuation insertion
98
- - Handling of filler words and disfluencies
99
- - Improved text normalization
100
 
101
- ## Evaluation
 
 
102
 
103
- Evaluated on [SpeechIO-Formal](https://huggingface.co/datasets/TaurenMountain/Speechio-Formal) benchmark — a formal-domain Chinese speech recognition test set covering news, presentations, lectures, and other formal speech scenarios.
104
 
105
- ## License
106
 
107
- Apache 2.0
 
 
108
 
109
- ## Citation
 
 
 
110
 
111
- If you use this model in your research, please cite:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  ```bibtex
114
- @inproceedings{ning2026formalasr,
115
- title={FormalASR: End-to-End Spoken Chinese to Formal Text},
116
- author={Ning, Wanyi and Qian, Haitao and Cheng, Jiyuan and Feng, Weiyuan and Zhang, Yufei},
117
- booktitle={arXiv preprint},
118
- year={2026}
 
 
 
119
  }
120
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FormalASR: End-to-End Spoken Chinese to Formal Text
2
+
3
+ <p align="center">
4
+ <a href="https://arxiv.org/abs/2605.19266"><img src="https://img.shields.io/badge/arXiv-2605.19266-b31b1b.svg" /></a>
5
+ <a href="https://huggingface.co/TaurenMountain/FormalASR-0.6B"><img src="https://img.shields.io/badge/🤗 FormalASR--0.6B-Model-yellow" /></a>
6
+ <a href="https://huggingface.co/TaurenMountain/FormalASR-1.7B"><img src="https://img.shields.io/badge/🤗 FormalASR--1.7B-Model-yellow" /></a>
7
+ <a href="https://huggingface.co/datasets/TaurenMountain/WenetSpeech-Formal"><img src="https://img.shields.io/badge/🤗 WenetSpeech--Formal-Dataset-orange" /></a>
8
+ <a href="https://huggingface.co/datasets/TaurenMountain/Speechio-Formal"><img src="https://img.shields.io/badge/🤗 Speechio--Formal-Dataset-orange" /></a>
9
+ <a href="#"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
10
+ <a href="#"><img src="https://img.shields.io/badge/Python-3.8+-green.svg" /></a>
11
+ <a href="https://www.yijiahe.com/"><img src="https://img.shields.io/badge/Released%20by-亿嘉和-red" /></a>
12
+ </p>
13
+
14
+ **FormalASR** 是一组基于 [Qwen3-ASR](https://huggingface.co/Qwen/Qwen3-ASR-1.7B) 微调的紧凑型端到端中文语音识别模型,专为**书面体转写**设计:直接从语音输入输出规范的书面文本,自动完成去除口语填充词、句式和标点规范化,**无需额外的 LLM 后处理步骤**,适合设备端部署。
15
+
16
+ > **口语输入** → 这个上上一像这个进料这一块一定要把关哪怕说是价钱贵点儿然后咱进点儿好料咱能保障咱
17
+ >
18
+ > **FormalASR 输出** → 进料这一块一定要把关,哪怕价钱贵点,我们也能进点好料,以保障质量。
19
+
20
+ ---
21
+
22
+ ## 🔥 新闻
23
+
24
+ - **2026-05**: 发布 FormalASR-0.6B、FormalASR-1.7B 模型及 WenetSpeech-Formal、Speechio-Formal 数据集!
25
+ - **2026-05**: 论文 [*FormalASR: End-to-End Spoken Chinese to Formal Text*](https://arxiv.org/abs/2605.19266) 上传 arXiv。
26
+
27
+ ---
28
+
29
+ ## 📖 论文摘要
30
+
31
+ ASR 系统通常针对逐字转写进行优化,保留了口语中的填充词、重复和非正式句式,不适合文档生成等下游应用。常见的两阶段 ASR+LLM 方案会带来延迟和内存开销,难以在设备端部署。
32
+
33
+ 本文提出 **FormalASR**,两个紧凑型端到端模型(0.6B 和 1.7B),直接将普通话语音转写为规范书面文本。为此,我们构建了 **WenetSpeech-Formal**(969K 训练样本)和 **Speechio-Formal**(43K 跨域测试样本)两个大规模书面体 ASR 数据集,通过 LLM 改写和质量过滤生成。在 WenetSpeech 和 Speechio 上的实验表明,FormalASR 在 CER、ROUGE-L 和 BERTScore 上均显著优于逐字转写基线。完整论文见 [arXiv](https://arxiv.org/abs/2605.19266)。
34
+
35
+ ---
36
+
37
+ ## 📂 数据集
38
+
39
+ | 数据集 | 样本量 | 音频来源 | 标注方式 | 用途 | HuggingFace |
40
+ |--------|--------|----------|----------|------|-------------|
41
+ | **WenetSpeech-Formal** (train) | 969,201 | WenetSpeech | DeepSeek-V3.2 书面化改写 | SFT 训练 | [🤗 TaurenMountain/WenetSpeech-Formal](https://huggingface.co/datasets/TaurenMountain/WenetSpeech-Formal) |
42
+ | **WenetSpeech-Formal** (test) | 31,932 | WenetSpeech | DeepSeek-V3.2 书面化改写 | 域内评估 | 同上 |
43
+ | **Speechio-Formal** (test) | 43,178 | Speechio (ZH00000–ZH00026) | DeepSeek-V3.2 书面化改写 | 跨域评估 | [🤗 TaurenMountain/Speechio-Formal](https://huggingface.co/datasets/TaurenMountain/Speechio-Formal) |
44
+
45
+ ### 数据构建流程
46
+
47
+ 1. **逐字转写收集**:使用 WenetSpeech / Speechio 的原始音频及其逐字口语转写
48
+ 2. **LLM 书面化改写**:调用 **DeepSeek-V3.2** 将口语文本改写为规范书面体(去填充词、重组句式、规范标点)
49
+ 3. **质量过滤**:过滤嵌入相似度过低(语义漂移)、编辑距离异常(无实质改写或幻觉)的样本
50
+
51
+ ### 数据示例
52
+
53
+ | 原始口语 (`original_text`) | 书面体 (`target_text`) |
54
+ |---------------------------|----------------------|
55
+ | 把这个呃增加的这个利润 | 把这个增加的利润。 |
56
+ | 对全美国全球影响影响不大 | 对美国全球影响不大。 |
57
+ | 但是我想这里这当中就是如果如果一定要那个挑一点儿什么的话 | 但是,如果一定要从中挑出一点什么的话。 |
58
+
59
  ---
60
+
61
+ ## 📦 模型
62
+
63
+ | 模型 | 参数量 | 训练方式 | HuggingFace |
64
+ |------|--------|----------|-------------|
65
+ | **FormalASR-0.6B** | 0.6B | SFT 全量微调 | [🤗 TaurenMountain/FormalASR-0.6B](https://huggingface.co/TaurenMountain/FormalASR-0.6B) |
66
+ | **FormalASR-1.7B** | 1.7B | SFT 全量微调 | [🤗 TaurenMountain/FormalASR-1.7B](https://huggingface.co/TaurenMountain/FormalASR-1.7B) |
67
+
 
 
 
 
 
68
  ---
69
 
70
+ ## 📊 评估结果
71
 
72
+ ### 域内:WenetSpeech-Formal
73
 
74
+ | 模型 | CER ↓ | ROUGE-L ↑ | BERTScore F1 ↑ |
75
+ |------|--------|-----------|----------------|
76
+ | Qwen3-ASR-0.6B(基线) | 0.2581 | 0.8463 | 0.9198 |
77
+ | **FormalASR-0.6B** | **0.1770** | **0.8769** | **0.9359** |
78
+ | Qwen3-ASR-1.7B(基线) | 0.2460 | 0.8571 | 0.9268 |
79
+ | **FormalASR-1.7B** | **0.1606** | **0.8896** | **0.9439** |
80
+ | Whisper large-v3 | 0.3631 | 0.7393 | 0.8538 |
81
 
82
+ ### 跨域:Speechio-Formal(27 个子集)
 
 
 
 
 
 
 
83
 
84
+ | 模型 | CER ↓ | ROUGE-L ↑ | BERTScore F1 ↑ |
85
+ |------|--------|-----------|----------------|
86
+ | Qwen3-ASR-0.6B(基线) | 0.2252 | 0.8701 | 0.9343 |
87
+ | **FormalASR-0.6B** | **0.1603** | **0.8948** | **0.9481** |
88
+ | Qwen3-ASR-1.7B(基线) | 0.2393 | 0.8510 | 0.9108 |
89
+ | **FormalASR-1.7B** | **0.1499** | **0.9029** | **0.9533** |
90
+ | Whisper large-v3 | 0.3302 | 0.7643 | 0.8795 |
91
 
92
+ > **评估指标说明**:CER(字符错误率,↓越低越好);ROUGE-L(最长公共子序列 F1,↑越高越好);BERTScore F1(语义相似度,↑越高越好)
 
 
93
 
94
+ ### 推理效率
95
 
96
+ FormalASR-1.7B 相比 Qwen3-ASR-1.7B,在 WenetSpeech-Formal 上**平均输出 token 减少 22.8%**(18.5→14.3),对于较长句子(40-49 token 区间)延迟减少约 388ms,书面化转写省去 filler 词使解码步骤更少。
97
+
98
+ ---
99
+
100
+ ## 🚀 快速开始
101
+
102
+ ### 安装
103
 
104
  ```bash
105
  pip install -U qwen-asr
106
  ```
107
 
108
+ ### HuggingFace 推理
109
 
110
  ```python
111
  import torch
 
133
  from modelscope import snapshot_download
134
  from qwen_asr import Qwen3ASRModel
135
 
 
136
  model_dir = snapshot_download("TaurenMountain/FormalASR-1.7B")
137
 
138
  model = Qwen3ASRModel.from_pretrained(
 
150
  print(results[0].text)
151
  ```
152
 
153
+ ---
154
 
155
+ ## 🏋️ 训练
156
 
157
+ ### 安装依赖
 
 
 
158
 
159
+ ```bash
160
+ pip install -U qwen-asr transformers datasets accelerate torch
161
+ ```
162
 
163
+ ### SFT 全量微调
164
 
165
+ 数据集自动从 HuggingFace Hub 下载,无需手动准备本地数据。
166
 
167
+ ```bash
168
+ # 单卡
169
+ bash run_sft.sh
170
 
171
+ # 多 GPU
172
+ CUDA_VISIBLE_DEVICES=0,1 \
173
+ OUTPUT_DIR=checkpoints/formalASR-1.7b-sft \
174
+ bash run_sft.sh
175
 
176
+ # 自定义基础模型
177
+ MODEL_PATH=TaurenMountain/FormalASR-0.6B bash run_sft.sh
178
+
179
+ # 从头训练(使用原始 Qwen3-ASR)
180
+ MODEL_PATH=Qwen/Qwen3-ASR-1.7B bash run_sft.sh
181
+ ```
182
+
183
+ ### GRPO 强化学习微调(实验性)
184
+
185
+ ```bash
186
+ bash run_grpo.sh
187
+
188
+ # 基于 SFT checkpoint 继续 GRPO 训练
189
+ CKPT=checkpoints/formalASR-1.7b-sft/checkpoint-1000 bash run_grpo.sh
190
+ ```
191
+
192
+ ### 评估
193
+
194
+ ```bash
195
+ # 评估 HuggingFace 上的模型
196
+ bash run_eval.sh
197
+
198
+ # 评估本地 checkpoint
199
+ CKPT=checkpoints/formalASR-1.7b-sft/checkpoint-1000 bash run_eval.sh
200
+
201
+ # 或使用 Python 命令自定义参数:
202
+ python -m eval.run \
203
+ --checkpoint TaurenMountain/FormalASR-1.7B \
204
+ --dataset_names wenetspeech,speechio \
205
+ --output_dir eval_results/ \
206
+ --batch_size 4
207
+ ```
208
+
209
+ ---
210
+
211
+ ## 📁 项目结构
212
+
213
+ ```
214
+ FormalASR/
215
+ ├── run_sft.sh # SFT 训练启动脚本
216
+ ├── run_grpo.sh # GRPO 训练启动脚本(实验性)
217
+ ├── run_eval.sh # 评估启动脚本
218
+ ├── common/ # 公共工具
219
+ │ ├── audio.py # 音频解码、HF Dataset 加载(含数据集 ID 映射)
220
+ │ ├── metrics.py # CER / WER / ROUGE-L / BERTScore
221
+ │ └── model_utils.py # patch_outer_forward(thinker 路由)
222
+ ├── sft/ # SFT 监督全量微调
223
+ │ ├── data.py # 从 HF Dataset 构建训练记录 + DataCollator
224
+ │ ├── model.py # Trainer / Callback 扩展
225
+ │ └── train.py # 训练入口(支持多数据集混合)
226
+ ├── grpo/ # GRPO 强化学习微调(实验性)
227
+ │ ├── reward.py # CER 奖励 + LLM judge 奖励
228
+ │ ├── trainer.py # MinimalGRPOTrainer
229
+ │ └── train.py # 训练入口
230
+ └── eval/ # 评估
231
+ ├── data.py # 指标重计算工具
232
+ ├── infer.py # 多后端推理(Qwen3ASR / Whisper / Pipeline / OpenAI Audio)
233
+ └── run.py # 评估入口(支持多数据集)
234
+ ```
235
+
236
+ ---
237
+
238
+
239
+ ## 📄 Citation
240
+
241
+ 如果本项目对你的研究有帮助,请引用:
242
 
243
  ```bibtex
244
+ @misc{ning2026formalasrendtoendspokenchinese,
245
+ title={FormalASR: End-to-End Spoken Chinese to Formal Text},
246
+ author={Wanyi Ning and Yinshang Guo and Haitao Qian and Jiyuan Cheng and Weiyuan Feng and Yufei Zhang},
247
+ year={2026},
248
+ eprint={2605.19266},
249
+ archivePrefix={arXiv},
250
+ primaryClass={cs.CL},
251
+ url={https://arxiv.org/abs/2605.19266},
252
  }
253
  ```
254
+
255
+ ---
256
+
257
+ ## 🙏 致谢
258
+
259
+ - 基础模型:[Qwen3-ASR](https://huggingface.co/Qwen/Qwen3-ASR-1.7B)
260
+ - 训练数据来源:[WenetSpeech](https://huggingface.co/datasets/speechcolab/gigaspeech)、[Speechio](https://github.com/SpeechColab/Leaderboard)
261
+ - LLM 书面化改写:[DeepSeek-V3.2](https://www.deepseek.com/)
262
+
263
+ ---
264
+
265
+ <p align="center">Made with ❤️ by <a href="https://www.yijiahe.com/">亿嘉和技术股份有限公司</a></p>