anhndbk commited on
Commit
29c076f
·
verified ·
1 Parent(s): 785412e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +395 -0
README.md ADDED
@@ -0,0 +1,395 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - vi
4
+ license: cc-by-nc-sa-4.0
5
+ multilinguality: monolingual
6
+ size_categories:
7
+ - n<1K
8
+ source_datasets:
9
+ - linhtran92/viet_bud500
10
+ task_categories:
11
+ - automatic-speech-recognition
12
+ tags:
13
+ - vietnamese
14
+ - benchmark
15
+ - quantization
16
+ - asr
17
+ - wer
18
+ - cer
19
+ - calibration
20
+ - evaluation
21
+ - audio
22
+ - speech
23
+ pretty_name: ViASR-Bench
24
+ dataset_info:
25
+ features:
26
+ - name: id
27
+ dtype: string
28
+ - name: transcript
29
+ dtype: string
30
+ - name: duration_s
31
+ dtype: float32
32
+ - name: sampling_rate
33
+ dtype: int32
34
+ - name: source_split
35
+ dtype: string
36
+ - name: audio
37
+ dtype:
38
+ audio:
39
+ sampling_rate: 16000
40
+ splits:
41
+ - name: calibration
42
+ num_examples: 256
43
+ - name: evaluation
44
+ num_examples: 600
45
+ download_size: 73400320
46
+ dataset_size: 73400320
47
+ ---
48
+
49
+ # ViASR-Bench 🇻🇳🎙️
50
+
51
+ **Vietnamese benchmark dataset for ASR model quantization — providing both a calibration set and an evaluation set.**
52
+
53
+ ViASR-Bench is a curated sample from [BUD500](https://huggingface.co/datasets/linhtran92/viet_bud500),
54
+ the largest public Vietnamese podcast speech dataset.
55
+ It is designed specifically for the **two-phase lifecycle of ASR quantization**:
56
+
57
+ | Phase | Split | Purpose |
58
+ |-------|-------|---------|
59
+ | **Calibration** | `calibration` (256 utterances) | Feed to AWQ / GPTQ / SmoothQuant to compute activation statistics and compensation factors |
60
+ | **Evaluation** | `evaluation` (600 utterances) | Measure WER / CER degradation after quantization |
61
+
62
+ > **Important:** This dataset is a **subsample of BUD500**, not a standalone corpus.
63
+ > Audio content is sourced from BUD500 (CC-BY-NC-SA 4.0) and is intended for
64
+ > **non-commercial research use only**.
65
+
66
+ ---
67
+
68
+ ## Dataset Summary
69
+
70
+ | Split | Utterances | Duration | Size (~) | Source in BUD500 |
71
+ |-------|-----------|----------|----------|------------------|
72
+ | `calibration` | 256 | ~10.9 min | ~21 MB | `train` split |
73
+ | `evaluation` | 600 | ~25.6 min | ~49 MB | `test` split |
74
+ | **Total** | **856** | **~36.5 min** | **~70 MB** | |
75
+
76
+ **Audio format:** 16 kHz · Mono · PCM-16 (WAV)
77
+
78
+ **Utterance duration statistics:**
79
+
80
+ | Split | Mean (s) | Median (s) | P10 (s) | P90 (s) | Max (s) |
81
+ |-------|---------|-----------|---------|---------|---------|
82
+ | calibration | 2.56 | 2.12 | 1.10 | 4.48 | 19.2 |
83
+ | evaluation | 2.56 | 2.11 | 1.09 | 4.52 | 19.8 |
84
+
85
+ ---
86
+
87
+ ## Motivation
88
+
89
+ ### Why a Vietnamese-specific ASR quantization benchmark?
90
+
91
+ Existing quantization tools (AWQ, GPTQ, SmoothQuant) require a **calibration dataset**
92
+ whose acoustic distribution matches the target language. Using English speech data
93
+ to calibrate a Vietnamese ASR model leads to suboptimal quantization because:
94
+
95
+ 1. **6-tone tonal system.** Vietnamese has six tones (ngang, huyền, sắc, hỏi, ngã, nặng)
96
+ that create unique patterns in mel-spectrograms and encoder feature spaces,
97
+ distinct from non-tonal languages.
98
+
99
+ 2. **Regional dialect variation.** Three major dialects (Northern, Central, Southern)
100
+ differ significantly in formant distributions and prosody, affecting attention
101
+ and convolution layers in ASR encoders.
102
+
103
+ 3. **Monosyllabic structure.** Vietnamese is predominantly monosyllabic, producing
104
+ different sequence-length and attention-pattern distributions than English.
105
+
106
+ Calibrating on English audio leaves these activation patterns unrepresented,
107
+ degrading quantization quality specifically for Vietnamese phonemes.
108
+
109
+ ### Why CER over WER for Vietnamese?
110
+
111
+ Vietnamese words average **1.7–2.2 characters**, making tone confusion errors
112
+ (e.g., *khoẻ* → *khoề*: a single diacritic change) inflate WER disproportionately:
113
+
114
+ ```
115
+ Reference: "bạn có khoẻ không" (4 words, 15 chars)
116
+ Hypothesis: "bạn có khoề không"
117
+
118
+ WER = 1/4 = 25.0% ← one wrong word
119
+ CER = 1/15 = 6.7% ← one wrong character
120
+ ```
121
+
122
+ CER is a more sensitive and fair metric for detecting tone-level degradation
123
+ caused by quantization on Vietnamese. **Both WER and CER are reported.**
124
+
125
+ ---
126
+
127
+ ## Source Data: BUD500
128
+
129
+ BUD500 is the largest public Vietnamese speech dataset (~500 hours of podcast audio
130
+ with manually verified transcripts, covering diverse topics and all three major dialects).
131
+
132
+ | Property | Value |
133
+ |----------|-------|
134
+ | Total duration | ~500 hours |
135
+ | Utterances | ~150,000 |
136
+ | Sampling rate | 16,000 Hz |
137
+ | Content type | Podcast (multi-topic) |
138
+ | Dialect coverage | Northern, Central, Southern |
139
+ | HuggingFace ID | `linhtran92/viet_bud500` |
140
+ | License | CC-BY-NC-SA 4.0 |
141
+
142
+ **Why BUD500 over alternatives?**
143
+
144
+ | Dataset | Hours | Quality | Diversity | Public |
145
+ |---------|-------|---------|-----------|--------|
146
+ | **BUD500** | ~500h | High | High | ✅ |
147
+ | VIVOS | 15h | High | Low (read speech) | ✅ |
148
+ | FLEURS vi | ~10h | Medium | Medium | ✅ |
149
+ | CommonVoice vi | ~30h | Medium | Medium | ✅ |
150
+ | VLSP | 100h+ | High | High | ❌ |
151
+
152
+ BUD500's size ensures that random sampling still yields diverse coverage.
153
+ Its podcast format is closer to real-world deployment conditions than
154
+ studio read-speech datasets like VIVOS.
155
+
156
+ ---
157
+
158
+ ## Sampling Methodology
159
+
160
+ ### Non-overlapping splits
161
+
162
+ Calibration and evaluation sets are **guaranteed non-overlapping by transcript**:
163
+
164
+ ```
165
+ eval_transcripts = {s["transcript"] for s in eval_samples}
166
+
167
+ # Calibration: skip any utterance whose transcript appears in eval
168
+ if transcript in eval_transcripts:
169
+ continue
170
+ ```
171
+
172
+ This prevents data leakage between calibration and evaluation.
173
+
174
+ ### Quality filter
175
+
176
+ Each utterance passes a 2-condition filter:
177
+
178
+ ```
179
+ keep(u) = True iff:
180
+ 1.0s ≤ duration(u) ≤ 20.0s # remove noise clips and unusually long segments
181
+ AND len(transcript(u)) > 0 # non-empty transcript
182
+ ```
183
+
184
+ ### Sampling procedure
185
+
186
+ ```
187
+ 1. Stream BUD500 (streaming=True) — no full download required
188
+ 2. Collect buffer = 5× target size from filtered utterances
189
+ 3. random.sample(buffer, n_target, seed=42) — fixed seed for reproducibility
190
+ ```
191
+
192
+ **Calibration** is drawn from BUD500 `train` split (seed=43).
193
+ **Evaluation** is drawn from BUD500 `test` split (seed=42).
194
+
195
+ ### Transcript normalization
196
+
197
+ All transcripts are stored in **Unicode NFC** normalized form.
198
+ Before computing WER/CER, apply the same normalization to model hypotheses:
199
+
200
+ ```python
201
+ import unicodedata, re
202
+
203
+ def normalise_vi(text: str) -> str:
204
+ text = unicodedata.normalize("NFC", text) # critical for Vietnamese diacritics
205
+ text = text.lower()
206
+ text = re.sub(r"[^\w\s]", " ", text, flags=re.UNICODE)
207
+ text = re.sub(r"\s+", " ", text).strip()
208
+ return text
209
+ ```
210
+
211
+ NFC normalization is critical because Vietnamese characters can be encoded two ways:
212
+ - Decomposed: `e` + combining hook above + combining dot below
213
+ - Precomposed: single codepoint `ệ`
214
+
215
+ Without normalization, visually identical strings may have non-zero edit distance.
216
+
217
+ ---
218
+
219
+ ## Usage
220
+
221
+ ### Installation
222
+
223
+ ```bash
224
+ pip install datasets soundfile jiwer transformers torch tqdm numpy
225
+ ```
226
+
227
+ ### Load the dataset
228
+
229
+ ```python
230
+ from datasets import load_dataset
231
+
232
+ # Evaluation split
233
+ eval_ds = load_dataset("your-org/vi-asr-bench", split="evaluation")
234
+
235
+ # Calibration split
236
+ calib_ds = load_dataset("your-org/vi-asr-bench", split="calibration")
237
+
238
+ # Each sample:
239
+ # {
240
+ # "id": "sample_0042",
241
+ # "audio": {"array": np.ndarray, "sampling_rate": 16000},
242
+ # "transcript": "xin chào thế giới",
243
+ # "duration_s": 3.21,
244
+ # "source_split": "test"
245
+ # }
246
+ ```
247
+
248
+ ### AWQ / GPTQ Calibration
249
+
250
+ ```python
251
+ import torch
252
+ from datasets import load_dataset
253
+
254
+ calib_ds = load_dataset("your-org/vi-asr-bench", split="calibration")
255
+
256
+ # Extract audio arrays for the encoder
257
+ audio_inputs = [
258
+ torch.tensor(sample["audio"]["array"]).unsqueeze(0) # (1, T)
259
+ for sample in calib_ds
260
+ ]
261
+
262
+ # Feed into your quantization calibration loop:
263
+ # for audio in audio_inputs:
264
+ # model.encoder(audio) # collect activation statistics
265
+ ```
266
+
267
+ ### WER / CER Evaluation
268
+
269
+ ```python
270
+ import unicodedata, re
271
+ from datasets import load_dataset
272
+ from jiwer import wer, cer
273
+ from transformers import pipeline
274
+
275
+ def normalise_vi(text):
276
+ text = unicodedata.normalize("NFC", text)
277
+ text = text.lower()
278
+ text = re.sub(r"[^\w\s]", " ", text, flags=re.UNICODE)
279
+ return re.sub(r"\s+", " ", text).strip()
280
+
281
+ eval_ds = load_dataset("your-org/vi-asr-bench", split="evaluation")
282
+ asr_pipe = pipeline("automatic-speech-recognition",
283
+ model="your-quantized-model",
284
+ generate_kwargs={"language": "vi", "task": "transcribe"})
285
+
286
+ references = [normalise_vi(s["transcript"]) for s in eval_ds]
287
+ hypotheses = [normalise_vi(r["text"]) for r in asr_pipe(
288
+ [s["audio"] for s in eval_ds], batch_size=8)]
289
+
290
+ print(f"WER: {wer(references, hypotheses)*100:.2f}%")
291
+ print(f"CER: {cer(references, hypotheses)*100:.2f}%")
292
+ ```
293
+
294
+ ### Compare quantized vs. baseline
295
+
296
+ ```bash
297
+ python vi_asr_eval.py \
298
+ --model openai/whisper-large-v3 \
299
+ --compare your-org/whisper-large-v3-int4 \
300
+ --output results.json
301
+ ```
302
+
303
+ Expected output format:
304
+
305
+ ```
306
+ ================================================================
307
+ Metric openai/whisper-large-v3 your-org/...-int4 Delta
308
+ ----------------------------------------------------------------
309
+ WER 8.24% 8.91% +0.67%
310
+ CER 3.11% 3.38% +0.27%
311
+ ```
312
+
313
+ ---
314
+
315
+ ## Reproducibility
316
+
317
+ Full metadata is stored in `metadata.json` for each split:
318
+
319
+ ```json
320
+ {
321
+ "split": "evaluation",
322
+ "n_samples": 600,
323
+ "seed": 42,
324
+ "source": "linhtran92/viet_bud500",
325
+ "source_split": "test",
326
+ "sampling_rate": 16000,
327
+ "total_duration_s": 1536.0,
328
+ "total_duration_min": 25.6,
329
+ "total_size_mb": 49.1,
330
+ "filter": {"min_dur_s": 1.0, "max_dur_s": 20.0},
331
+ "normalization": "unicode_nfc"
332
+ }
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Relation to ViWiki-Bench
338
+
339
+ ViASR-Bench is the **speech counterpart** of ViWiki-Bench (Vietnamese LLM benchmark).
340
+ Together they form a complete Vietnamese quantization benchmark suite:
341
+
342
+ | | ViWiki-Bench (LLM) | ViASR-Bench (ASR) |
343
+ |---|---|---|
344
+ | Input modality | Text (token IDs) | Audio (float32 arrays) |
345
+ | Calibration | 128 sequences from Wikipedia vi | 256 utterances from BUD500 train |
346
+ | Evaluation | ~280k tokens from Wikipedia vi | 600 utterances from BUD500 test |
347
+ | Metric | Perplexity (PPL) | WER / CER |
348
+ | Source dataset | `wikimedia/wikipedia` 20231101.vi | `linhtran92/viet_bud500` |
349
+
350
+ ---
351
+
352
+ ## Limitations
353
+
354
+ - **Single source:** Only BUD500 (podcast). Read speech (VIVOS), spontaneous conversation,
355
+ and children's speech are not represented.
356
+ - **No dialect labels:** BUD500 does not tag individual utterances with Northern/Central/Southern
357
+ dialect, so stratified sampling by dialect is not possible.
358
+ - **Small evaluation set:** 600 utterances (~26 min) is sufficient for relative comparison
359
+ between quantization methods, but not for high-precision absolute WER estimation
360
+ (vs. LibriSpeech test-clean at 5.4 hours).
361
+ - **Non-commercial license:** Inherited from BUD500 (CC-BY-NC-SA 4.0).
362
+ Not suitable for commercial product deployment.
363
+
364
+ ---
365
+
366
+ ## Citation
367
+
368
+ If you use ViASR-Bench in your research, please cite both this dataset and BUD500:
369
+
370
+ ```bibtex
371
+ @techreport{viasr_bench2024,
372
+ title = {ViASR-Bench: A Vietnamese Benchmark Dataset for
373
+ ASR Model Quantization Calibration and Evaluation},
374
+ author = {AnhND},
375
+ year = {2026},
376
+ note = {Technical Report v1.0. Sampled from linhtran92/viet\_bud500},
377
+ url = {https://huggingface.co/datasets/your-org/vi-asr-bench}
378
+ }
379
+
380
+ @dataset{bud500,
381
+ title = {BUD500: A Large-Scale Vietnamese Podcast Speech Dataset},
382
+ author = {Linh Tran},
383
+ publisher = {HuggingFace},
384
+ url = {https://huggingface.co/datasets/linhtran92/viet_bud500}
385
+ }
386
+ ```
387
+
388
+ ---
389
+
390
+ ## License
391
+
392
+ This dataset inherits the license of its source:
393
+ **CC-BY-NC-SA 4.0** (Non-Commercial).
394
+
395
+ The sampling and evaluation code is released under **MIT License**.