🎤 Vietnamese Pronunciation Classifier (ONNX)
Mô hình phân loại phát âm tiếng Việt (Miền Nam) — phân biệt phát âm đúng và phát âm sai cho các phụ âm D/R/GI.
Model Details
| Attribute | Value |
|---|---|
| Base Model | wav2vec2-large-vi-vlsp2020 |
| Format | ONNX (cross-platform) |
| Task | Binary Classification (correct / wrong) |
| Language | Vietnamese (Southern dialect) |
| Sample Rate | 16 kHz |
| Audio Duration | 500ms per sample |
| Validation Accuracy | 80.3% |
| ONNX Opset | 14 |
Classes
| Label | Class ID | Description |
|---|---|---|
✅ correct |
0 | Phát âm đúng |
❌ wrong |
1 | Phát âm sai (nhầm D/R/GI) |
Quick Start — ONNX Runtime
pip install onnxruntime librosa numpy
import numpy as np
import librosa
import onnxruntime as ort
from huggingface_hub import hf_hub_download
# 1. Download model
repo_id = "Bao2311/wav2vec2-vi-pronunciation-onnx"
onnx_path = hf_hub_download(repo_id, "phoneme_classifier.onnx")
data_path = hf_hub_download(repo_id, "phoneme_classifier.onnx.data")
# 2. Load ONNX session
session = ort.InferenceSession(onnx_path, providers=["CPUExecutionProvider"])
# 3. Load & preprocess audio (16kHz, 500ms)
audio, _ = librosa.load("your_audio.wav", sr=16000, mono=True)
audio = audio[:8000] # crop to 500ms = 8000 samples
if len(audio) < 8000:
audio = np.pad(audio, (0, 8000 - len(audio)))
# 4. Normalize
audio = audio.astype(np.float32)
mean, std = audio.mean(), audio.std()
if std > 0:
audio = (audio - mean) / std
# 5. Inference
input_values = audio.reshape(1, -1)
logits = session.run(None, {"input_values": input_values})[0][0]
# 6. Softmax → prediction
exp_logits = np.exp(logits - np.max(logits))
probs = exp_logits / exp_logits.sum()
pred = int(np.argmax(probs))
labels = {0: "correct ✅", 1: "wrong ❌"}
print(f"Prediction: {labels[pred]} (confidence: {probs[pred]:.1%})")
Files
| File | Size | Description |
|---|---|---|
phoneme_classifier.onnx |
~2.5 MB | ONNX model graph |
phoneme_classifier.onnx.data |
~1.2 GB | Model weights (external data) |
config.json |
<1 KB | Model configuration |
preprocessor_config.json |
<1 KB | Feature extractor config |
Training Details
- Base model:
nguyenvulebinh/wav2vec2-large-vi-vlsp2020 - Epochs: 10
- Batch Size: 4
- Learning Rate: 1e-4
- Optimizer: AdamW
- Loss: CrossEntropyLoss
- Frozen layers: Wav2Vec2 feature extractor + first 8 encoder layers
Limitations
- Chỉ hỗ trợ tiếng Việt (giọng Miền Nam)
- Tối ưu cho audio 500ms, 16kHz mono
- Binary classification (đúng/sai), chưa phân loại chi tiết loại lỗi
License
Apache 2.0
- Downloads last month
- 8
Model tree for Bao2311/wav2vec2-vi-pronunciation-onnx
Base model
nguyenvulebinh/wav2vec2-large-vi-vlsp2020Evaluation results
- Validation Accuracyself-reported80.300