ASLP-lab commited on
Commit
4bf1c22
·
verified ·
1 Parent(s): ef2ae18

Simplify usage examples and link training recipes

Browse files
Files changed (1) hide show
  1. README.md +36 -190
README.md CHANGED
@@ -9,240 +9,86 @@ base_model:
9
  tags:
10
  - wenetspeech-min
11
  - minnan
12
- - southern-min
13
  - speech-recognition
14
  - paired-transcript-asr
15
- - qwen3-asr
16
  ---
17
 
18
  # WenetSpeech-Min ASR Models
19
 
20
- These ASR models accompany
21
- [WenetSpeech-Min: A Large-Scale Minnan Speech Corpus with Dual Transcriptions for Dialectal Speech Processing](https://arxiv.org/abs/2609.36834).
22
- WenetSpeech-Min comprises around **10,000 hours of Minnan speech** from online
23
- media, pairing each utterance with a Minnan transcript and a Mandarin transcript.
24
-
25
- The models support **Minnan transcription**, **Mandarin transcription**, and
26
- **paired-transcript recognition**. Minnan transcripts retain dialectal wording;
27
- Mandarin transcripts express the same content in written Mandarin, without
28
- requiring word-by-word alignment with the spoken Minnan.
29
-
30
- [Code](https://github.com/ASLP-lab/WenetSpeech-Min-Repo) |
31
- [Paper](https://arxiv.org/abs/2609.36834) |
32
- [Qwen3-ASR](https://huggingface.co/Qwen/Qwen3-ASR-1.7B) |
33
- [FireRedASR2-AED](https://huggingface.co/FireRedTeam/FireRedASR2-AED)
34
 
35
  ## Available Models
36
 
37
- | Model | Task | Fine-tuning framework |
38
  | --- | --- | --- |
39
  | [Qwen3-ASR-WSM-Min](https://huggingface.co/ASLP-lab/WS-Min-ASR/tree/main/Qwen3-ASR-WSM-Min) | Minnan transcription | ms-swift |
40
  | [Qwen3-ASR-WSM-Mandarin](https://huggingface.co/ASLP-lab/WS-Min-ASR/tree/main/Qwen3-ASR-WSM-Mandarin) | Mandarin transcription | ms-swift |
41
  | [FireRedASR2-AED-WSM](https://huggingface.co/ASLP-lab/WS-Min-ASR/tree/main/FireRedASR2-AED-WSM) | Paired-transcript recognition | WeNet |
42
 
43
- All three models take Minnan speech as input. Each Qwen checkpoint provides one
44
- transcription target; FireRedASR2-AED-WSM supports both targets in one model.
45
-
46
- ## Install
47
-
48
- Follow the official installation instructions for the relevant framework:
49
-
50
- - [Qwen3-ASR environment setup](https://github.com/QwenLM/Qwen3-ASR#environment-setup) for Qwen inference, including the vLLM backend.
51
- - [ms-swift installation](https://swift.readthedocs.io/en/latest/GetStarted/SWIFT-installation.html) for Qwen fine-tuning.
52
- - [WeNet installation for training and deployment](https://github.com/wenet-e2e/wenet#install-for-training--deployment) for FireRed fine-tuning and inference.
53
 
54
- Clone the training and inference recipes:
55
 
56
- ```bash
57
- git clone https://github.com/ASLP-lab/WenetSpeech-Min-Repo.git
58
- cd WenetSpeech-Min-Repo
59
- ```
60
-
61
- For FireRed paired-transcript recognition, run
62
- `bash FireRedASR2-AED-WSM/setup_wenet.sh` to prepare the matching WeNet task-embedding implementation.
63
-
64
- ### Model download
65
-
66
- Download only the selected model's inference assets, excluding optimizer and
67
- trainer state files:
68
-
69
- ```python
70
- from huggingface_hub import snapshot_download
71
-
72
- model_subdir = "Qwen3-ASR-WSM-Min"
73
- # For Mandarin output instead, use: model_subdir = "Qwen3-ASR-WSM-Mandarin"
74
-
75
- inference_files = [
76
- "config.json", "generation_config.json", "preprocessor_config.json",
77
- "tokenizer_config.json", "tokenizer.json", "vocab.json", "merges.txt",
78
- "added_tokens.json", "special_tokens_map.json", "chat_template.jinja",
79
- "chat_template.json", "model*.safetensors", "model*.safetensors.index.json",
80
- ]
81
- snapshot_download(
82
- repo_id="ASLP-lab/WS-Min-ASR",
83
- allow_patterns=[f"{model_subdir}/{name}" for name in inference_files]
84
- + ["examples/G1216S0004.wav"],
85
- local_dir="pretrained_models/WS-Min-ASR",
86
- )
87
- ```
88
-
89
- The model files will be placed in
90
- `pretrained_models/WS-Min-ASR/Qwen3-ASR-WSM-Min/` (or the Mandarin subdirectory).
91
- Use a specific `revision` commit when a fixed checkpoint revision is required.
92
 
93
  ## Usage
94
 
95
- ### Qwen inference with vLLM
96
 
97
- After the download above, this example transcribes the supplied demonstration
98
- audio. No reference transcript is needed:
99
 
100
  ```python
 
101
  from qwen_asr import Qwen3ASRModel
102
 
103
- model_dir = "pretrained_models/WS-Min-ASR/Qwen3-ASR-WSM-Min"
104
- # For Mandarin output, change the model directory to Qwen3-ASR-WSM-Mandarin.
105
- audio_path = "pretrained_models/WS-Min-ASR/examples/G1216S0004.wav"
106
-
107
- # Keep vLLM initialization under the main guard for multiprocessing.
108
  if __name__ == "__main__":
 
 
 
 
 
 
 
109
  model = Qwen3ASRModel.LLM(
110
- model=model_dir,
111
  gpu_memory_utilization=0.8,
112
  max_model_len=8192,
113
- max_inference_batch_size=8,
114
  max_new_tokens=1024,
115
  )
116
  results = model.transcribe(
117
- audio=audio_path,
118
  language=None,
119
- return_time_stamps=False,
120
  )
121
  print(results[0].text)
122
  ```
123
 
124
- The checkpoint selects the transcription target; changing `language` is not a
125
- replacement for switching the Minnan and Mandarin checkpoints.
126
 
127
- The GitHub recipes also provide ready-to-run inference commands that download
128
- the correct model automatically:
129
-
130
- ```bash
131
- # Run from the GitHub repository root. Each directory includes the sample audio.
132
- CUDA_VISIBLE_DEVICES=0 bash Qwen3-ASR-Min/infer.sh
133
- CUDA_VISIBLE_DEVICES=0 bash Qwen3-ASR-Mandarin/infer.sh
134
-
135
- # User-provided audio and JSONL output:
136
- bash Qwen3-ASR-Min/infer.sh --audio /path/to/audio.wav --output /path/to/new-result.jsonl
137
-
138
- # Optional Transformers backend:
139
- bash Qwen3-ASR-Min/infer.sh --backend transformers
140
- ```
141
-
142
- The output contains the audio identifier, path, transcription target, language,
143
- and recognized text. Several audio paths may follow `--audio` for batch inference.
144
-
145
- ### FireRed paired-transcript recognition
146
-
147
- Download the FireRed checkpoint and its tokenizer/CMVN assets:
148
-
149
- ```python
150
- from huggingface_hub import snapshot_download
151
-
152
- snapshot_download(
153
- repo_id="ASLP-lab/WS-Min-ASR",
154
- allow_patterns=["FireRedASR2-AED-WSM/*"],
155
- local_dir="pretrained_models/WS-Min-ASR",
156
- )
157
- ```
158
-
159
- Run inference from the GitHub repository root:
160
 
161
  ```bash
 
 
 
 
 
162
  CUDA_VISIBLE_DEVICES=0 bash FireRedASR2-AED-WSM/infer.sh \
163
  --model-dir pretrained_models/WS-Min-ASR/FireRedASR2-AED-WSM \
164
  --task both
165
  ```
166
 
167
- Use `--task minnan` for the Minnan transcript or `--task mandarin` for the
168
- Mandarin transcript. `--task both` returns `text_minnan` and `text_mandarin`.
169
- Override the included sample with `--audio /path/to/audio.wav`.
170
 
171
  ## Training
172
 
173
- The [GitHub repository](https://github.com/ASLP-lab/WenetSpeech-Min-Repo) contains
174
- the training recipes for all three models. Each recipe reads a JSONL manifest,
175
- with one training example per line. Use the corresponding format below for
176
- both training and validation manifests. Audio paths must resolve on the
177
- training machine.
178
-
179
- ### Qwen3-ASR-WSM-Min: Minnan transcription
180
-
181
- [Training code](https://github.com/ASLP-lab/WenetSpeech-Min-Repo/tree/main/Qwen3-ASR-Min)
182
-
183
- Supervision uses the Minnan transcripts of WenetSpeech-Min. The ms-swift
184
- training format is:
185
-
186
- ```json
187
- {"key":"example_001","messages":[{"role":"user","content":"<audio>"},{"role":"assistant","content":"language Chinese<asr_text>你欲食啥物?"}],"audios":["/path/to/audio/example_001.wav"]}
188
- ```
189
-
190
- ```bash
191
- TRAIN_DATA=/path/to/train.minnan.jsonl \
192
- VAL_DATA=/path/to/validation.minnan.jsonl \
193
- bash Qwen3-ASR-Min/train.sh
194
- ```
195
-
196
- ### Qwen3-ASR-WSM-Mandarin: Mandarin transcription
197
-
198
- [Training code](https://github.com/ASLP-lab/WenetSpeech-Min-Repo/tree/main/Qwen3-ASR-Mandarin)
199
-
200
- Training combines MinSpeech with the Mandarin transcripts of WenetSpeech-Min.
201
- Use the same ms-swift schema with the Mandarin transcript as the assistant target:
202
-
203
- ```json
204
- {"key":"example_001","messages":[{"role":"user","content":"<audio>"},{"role":"assistant","content":"language Chinese<asr_text>你想吃什么?"}],"audios":["/path/to/audio/example_001.wav"]}
205
- ```
206
-
207
- ```bash
208
- TRAIN_DATA=/path/to/train.mandarin.jsonl \
209
- VAL_DATA=/path/to/validation.mandarin.jsonl \
210
- bash Qwen3-ASR-Mandarin/train.sh
211
- ```
212
-
213
- ### FireRedASR2-AED-WSM: paired-transcript recognition
214
-
215
- [Training code](https://github.com/ASLP-lab/WenetSpeech-Min-Repo/tree/main/FireRedASR2-AED-WSM)
216
-
217
- Paired transcripts supervise one model; two learnable task embeddings select
218
- the output target, and CTC loss is disabled. Represent each recording as two
219
- WeNet raw JSONL examples sharing the same audio path:
220
-
221
- ```json
222
- {"key":"example_001_transcribe_minnan","wav":"/path/to/audio/example_001.wav","txt":"你欲食啥物?","task":"transcribe_minnan","lang":"zh"}
223
- {"key":"example_001_translate_zh","wav":"/path/to/audio/example_001.wav","txt":"你想吃什么?","task":"translate_zh","lang":"zh"}
224
- ```
225
-
226
- `transcribe_minnan` selects the Minnan transcript; `translate_zh` selects the
227
- Mandarin transcript. These are the task identifiers used by the implementation.
228
-
229
- ```bash
230
- BASE_MODEL_DIR=/path/to/wenet-converted-FireRedASR2-AED \
231
- TRAIN_DATA=/path/to/train.paired.jsonl \
232
- VAL_DATA=/path/to/validation.paired.jsonl \
233
- bash FireRedASR2-AED-WSM/train.sh
234
- ```
235
-
236
- `BASE_MODEL_DIR` contains the converted base checkpoint `wenet_firered.pt`,
237
- `global_cmvn`, `train_bpe1000.model`, and `units.txt`. See the
238
- [FireRed training recipe](https://github.com/ASLP-lab/WenetSpeech-Min-Repo/tree/main/FireRedASR2-AED-WSM)
239
- for base-model conversion. Each recipe directory also includes `prepare_data.py`
240
- for converting paired audio/transcript manifests to its training format.
241
-
242
- ## Acknowledgements
243
-
244
- This work builds on [Qwen3-ASR](https://github.com/QwenLM/Qwen3-ASR),
245
- [ms-swift](https://github.com/modelscope/ms-swift),
246
- [FireRedASR2S](https://github.com/FireRedTeam/FireRedASR2S), and
247
- [WeNet](https://github.com/wenet-e2e/wenet). Please retain upstream license and
248
- attribution notices when using or redistributing their components.
 
9
  tags:
10
  - wenetspeech-min
11
  - minnan
 
12
  - speech-recognition
13
  - paired-transcript-asr
 
14
  ---
15
 
16
  # WenetSpeech-Min ASR Models
17
 
18
+ ASR models for Minnan transcription, Mandarin transcription, and paired-transcript
19
+ recognition, described in [WenetSpeech-Min](https://arxiv.org/abs/2609.36834).
20
+ The corpus contains around 10,000 hours of Minnan speech, with paired Minnan
21
+ and Mandarin transcripts for each utterance.
 
 
 
 
 
 
 
 
 
 
22
 
23
  ## Available Models
24
 
25
+ | Model | Task | Framework |
26
  | --- | --- | --- |
27
  | [Qwen3-ASR-WSM-Min](https://huggingface.co/ASLP-lab/WS-Min-ASR/tree/main/Qwen3-ASR-WSM-Min) | Minnan transcription | ms-swift |
28
  | [Qwen3-ASR-WSM-Mandarin](https://huggingface.co/ASLP-lab/WS-Min-ASR/tree/main/Qwen3-ASR-WSM-Mandarin) | Mandarin transcription | ms-swift |
29
  | [FireRedASR2-AED-WSM](https://huggingface.co/ASLP-lab/WS-Min-ASR/tree/main/FireRedASR2-AED-WSM) | Paired-transcript recognition | WeNet |
30
 
31
+ ## Installation
 
 
 
 
 
 
 
 
 
32
 
33
+ Follow the official installation guides:
34
 
35
+ - [Qwen3-ASR](https://github.com/QwenLM/Qwen3-ASR#environment-setup), including the vLLM backend for inference.
36
+ - [ms-swift](https://swift.readthedocs.io/en/latest/GetStarted/SWIFT-installation.html) for Qwen fine-tuning.
37
+ - [WeNet](https://github.com/wenet-e2e/wenet#install-for-training--deployment) for FireRed fine-tuning and inference.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  ## Usage
40
 
41
+ ### Qwen3-ASR
42
 
43
+ Select `Qwen3-ASR-WSM-Min` for Minnan output or `Qwen3-ASR-WSM-Mandarin`
44
+ for Mandarin output. Both take Minnan audio as input.
45
 
46
  ```python
47
+ from huggingface_hub import snapshot_download
48
  from qwen_asr import Qwen3ASRModel
49
 
 
 
 
 
 
50
  if __name__ == "__main__":
51
+ subfolder = "Qwen3-ASR-WSM-Min" # Or "Qwen3-ASR-WSM-Mandarin"
52
+ model_root = snapshot_download(
53
+ repo_id="ASLP-lab/WS-Min-ASR",
54
+ allow_patterns=[f"{subfolder}/*.safetensors", f"{subfolder}/*.json",
55
+ f"{subfolder}/*.txt", f"{subfolder}/*.jinja",
56
+ "examples/G1216S0004.wav"],
57
+ )
58
  model = Qwen3ASRModel.LLM(
59
+ model=f"{model_root}/{subfolder}",
60
  gpu_memory_utilization=0.8,
61
  max_model_len=8192,
 
62
  max_new_tokens=1024,
63
  )
64
  results = model.transcribe(
65
+ audio=f"{model_root}/examples/G1216S0004.wav", # Or your audio path
66
  language=None,
 
67
  )
68
  print(results[0].text)
69
  ```
70
 
71
+ ### FireRedASR2-AED-WSM
 
72
 
73
+ Download the model and run paired-transcript recognition with the GitHub recipe:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  ```bash
76
+ git clone https://github.com/ASLP-lab/WenetSpeech-Min-Repo.git
77
+ cd WenetSpeech-Min-Repo
78
+ bash FireRedASR2-AED-WSM/setup_wenet.sh
79
+ hf download ASLP-lab/WS-Min-ASR --include "FireRedASR2-AED-WSM/*" \
80
+ --local-dir pretrained_models/WS-Min-ASR
81
  CUDA_VISIBLE_DEVICES=0 bash FireRedASR2-AED-WSM/infer.sh \
82
  --model-dir pretrained_models/WS-Min-ASR/FireRedASR2-AED-WSM \
83
  --task both
84
  ```
85
 
86
+ Use `--task minnan` or `--task mandarin` for a single transcript.
87
+ Add `--audio /path/to/audio.wav` to use your own audio; otherwise the included
88
+ example is used. Paired output contains `text_minnan` and `text_mandarin`.
89
 
90
  ## Training
91
 
92
+ - [Minnan transcription: Qwen3-ASR-WSM-Min](https://github.com/ASLP-lab/WenetSpeech-Min-Repo/tree/main/Qwen3-ASR-Min)
93
+ - [Mandarin transcription: Qwen3-ASR-WSM-Mandarin](https://github.com/ASLP-lab/WenetSpeech-Min-Repo/tree/main/Qwen3-ASR-Mandarin)
94
+ - [Paired-transcript recognition: FireRedASR2-AED-WSM](https://github.com/ASLP-lab/WenetSpeech-Min-Repo/tree/main/FireRedASR2-AED-WSM)