Hệ thống nhận dạng giọng nói tiếng Việt sử dụng kiến trúc TDT (Token-and-Duration Transducer) với:
Chi tiết kiến trúc: ARCHITECTURE.md
# Clone repo
git clone <repo-url>
cd ASR
# Cài đặt toàn bộ dependencies (PyTorch CUDA 12.9 + NeMo + tools)
pixi install
# Kiểm tra CUDA
pixi run python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}, Device: {torch.cuda.get_device_name(0)}')"
# Default training
pixi run train
# Training với W&B logging
WANDB_API_KEY=your_key pixi run train
# Override config từ CLI
pixi run train trainer.max_epochs=100 optimizer.lr=5e-5
pixi run train model.decoder.predictor.hidden_dim=512
# Resume từ checkpoint
pixi run train model.checkpoint_path=outputs/training/checkpoints/last.ckpt
| Component | Yêu cầu |
|---|---|
| GPU | NVIDIA RTX 3090 (24GB VRAM) hoặc tương đương |
| CUDA | 12.9 |
| RAM | 32GB+ |
| Storage | 50GB+ (model + dataset + checkpoints) |
| Python | 3.11 - 3.12 |
ASR/
├── conf/ # Hydra configuration
│ ├── config.yaml # Main config
│ ├── model/
│ │ ├── tdt-vi.yaml # TDT-VI model settings
│ │ └── parakeet-encoder.yaml # Encoder config
│ ├── decoder/
│ │ └── tdt.yaml # TDT decoder architecture
│ ├── trainer/
│ │ └── lightning.yaml # Lightning trainer
│ ├── dataset/
│ │ └── vlsp2020.yaml # Dataset config
│ ├── logging/
│ │ └── wandb.yaml # W&B logging
│ └── cache/
│ └── redis.yaml # Redis caching
├── src/asr/
│ ├── models/
│ │ ├── tdt_vi.py # Main TDT-VI model
│ │ └── components/
│ │ ├── encoder.py # Parakeet encoder wrapper
│ │ ├── predictor.py # TDT predictor (RNN)
│ │ └── joint.py # TDT joint network
│ ├── training/
│ │ ├── train.py # Entry point (@hydra.main)
│ │ ├── lightning_module.py # LightningModule
│ │ └── datamodule.py # LightningDataModule
│ ├── api/ # (future)
│ └── utils/ # (future)
├── tests/
│ ├── conftest.py
│ ├── test_tdt_components.py
│ └── test_lightning_module.py
├── ARCHITECTURE.md # Architecture documentation
├── pyproject.toml
└── .pre-commit-config.yaml
Tất cả config có thể override từ CLI:
# Training params
pixi run train trainer.max_epochs=100
pixi run train trainer.accumulate_grad_batches=8
pixi run train optimizer.lr=1e-4
pixi run train optimizer.weight_decay=0.01
# Model architecture
pixi run train model.decoder.predictor.hidden_dim=512
pixi run train model.decoder.predictor.num_layers=2
pixi run train model.decoder.joint.hidden_dim=512
# Dataset
pixi run train dataset.max_train_samples=10000
pixi run train dataset.max_eval_samples=1000
# Logging
pixi run train ~logging/wandb # Disable W&B
pixi run train logging.wandb.project=my-project # Change project name
# Checkpoints
pixi run train model.checkpoint_path=outputs/training/checkpoints/last.ckpt
| File | Mô tả |
|---|---|
conf/trainer/lightning.yaml | GPU, precision, epochs, gradient clipping, early stopping |
conf/decoder/tdt.yaml | Predictor (LSTM), Joint network, loss config |
conf/model/parakeet-encoder.yaml | Encoder freeze, projection, feature extraction |
conf/dataset/vlsp2020.yaml | Dataset path, splits, sampling rate |
# 1. SSH vào server
ssh user@your-server
# 2. Cài đặt pixi (nếu chưa có)
curl -fsSL https://pixi.sh/install.sh | bash
# 3. Clone repo
git clone <repo-url>
cd ASR
# 4. Cài đặt environment (~10-15 phút, tải PyTorch + NeMo)
pixi install
# 5. Login W&B (optional)
wandb login
# Cơ bản
pixi run train
# Với W&B logging để theo dõi từ xa
pixi run train logging.wandb.enabled=true
# Multi-GPU (nếu có nhiều GPU)
pixi run train trainer.devices=2 trainer.strategy=ddp
# Precision thấp hơn để nhanh hơn (RTX 3090 hỗ trợ FP16 tốt)
pixi run train trainer.precision="16-mixed"
# Gradient accumulation lớn hơn nếu VRAM ít
pixi run train trainer.accumulate_grad_batches=8
https://wandb.ai/your-project để xem loss, WER, CER real-timewatch -n 1 nvidia-smioutputs/training/logs/Sau khi train xong:
outputs/training/
├── checkpoints/
│ ├── epoch=10-val_wer=0.1234.ckpt
│ ├── epoch=15-val_wer=0.1123.ckpt ← best model
│ └── last.ckpt
├── logs/
└── model_config.json
pixi run test
pixi run lint # Ruff check + fix
pixi run format # Ruff format
pixi run typecheck # Pyrefly type check
# Install hooks
pre-commit install
# Run manually
pre-commit run --all-files
Project sử dụng dataset VLSP 2020 (~100 hours tiếng Việt):
doof-ferb/vlsp2020_vinai_100hconf/dataset/vlsp2020.yamlAudio (16kHz)
│
▼
┌─────────────────────────────┐
│ Parakeet Encoder (FROZEN) │
│ FastConformer, ~600M params│
│ Output: Hidden States │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ TDT Decoder (TRAIN) │
│ ┌───────────────────────┐ │
│ │ Predictor (LSTM) │ │
│ │ Output: Context │ │
│ └──────────┬────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ Joint (2-headed) │ │
│ │ ├─ Token Head │ │
│ │ └─ Duration Head │ │
│ └───────────────────────┘ │
└─────────────────────────────┘
│
▼
Tokens + Durations
Ưu điểm:
# Giảm batch size, tăng gradient accumulation
pixi run train trainer.batch_size=8 trainer.accumulate_grad_batches=8
# Dùng precision thấp hơn
pixi run train trainer.precision="16-mixed"
# Đảm bảo CUDA 12.9 và PyTorch đúng version
pixi run python -c "import torch; print(torch.__version__, torch.version.cuda)"
# Cài lại
pixi reinstall
# Giới hạn samples cho debugging
pixi run train dataset.max_train_samples=1000 dataset.max_eval_samples=100
Internal project - For internal use only.
Hệ thống nhận dạng giọng nói tiếng Việt sử dụng kiến trúc TDT (Token-and-Duration Transducer) với:
Chi tiết kiến trúc: ARCHITECTURE.md
# Clone repo
git clone <repo-url>
cd ASR
# Cài đặt toàn bộ dependencies (PyTorch CUDA 12.9 + NeMo + tools)
pixi install
# Kiểm tra CUDA
pixi run python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}, Device: {torch.cuda.get_device_name(0)}')"
# Default training
pixi run train
# Training với W&B logging
WANDB_API_KEY=your_key pixi run train
# Override config từ CLI
pixi run train trainer.max_epochs=100 optimizer.lr=5e-5
pixi run train model.decoder.predictor.hidden_dim=512
# Resume từ checkpoint
pixi run train model.checkpoint_path=outputs/training/checkpoints/last.ckpt
| Component | Yêu cầu |
|---|---|
| GPU | NVIDIA RTX 3090 (24GB VRAM) hoặc tương đương |
| CUDA | 12.9 |
| RAM | 32GB+ |
| Storage | 50GB+ (model + dataset + checkpoints) |
| Python | 3.11 - 3.12 |
ASR/
├── conf/ # Hydra configuration
│ ├── config.yaml # Main config
│ ├── model/
│ │ ├── tdt-vi.yaml # TDT-VI model settings
│ │ └── parakeet-encoder.yaml # Encoder config
│ ├── decoder/
│ │ └── tdt.yaml # TDT decoder architecture
│ ├── trainer/
│ │ └── lightning.yaml # Lightning trainer
│ ├── dataset/
│ │ └── vlsp2020.yaml # Dataset config
│ ├── logging/
│ │ └── wandb.yaml # W&B logging
│ └── cache/
│ └── redis.yaml # Redis caching
├── src/asr/
│ ├── models/
│ │ ├── tdt_vi.py # Main TDT-VI model
│ │ └── components/
│ │ ├── encoder.py # Parakeet encoder wrapper
│ │ ├── predictor.py # TDT predictor (RNN)
│ │ └── joint.py # TDT joint network
│ ├── training/
│ │ ├── train.py # Entry point (@hydra.main)
│ │ ├── lightning_module.py # LightningModule
│ │ └── datamodule.py # LightningDataModule
│ ├── api/ # (future)
│ └── utils/ # (future)
├── tests/
│ ├── conftest.py
│ ├── test_tdt_components.py
│ └── test_lightning_module.py
├── ARCHITECTURE.md # Architecture documentation
├── pyproject.toml
└── .pre-commit-config.yaml
Tất cả config có thể override từ CLI:
# Training params
pixi run train trainer.max_epochs=100
pixi run train trainer.accumulate_grad_batches=8
pixi run train optimizer.lr=1e-4
pixi run train optimizer.weight_decay=0.01
# Model architecture
pixi run train model.decoder.predictor.hidden_dim=512
pixi run train model.decoder.predictor.num_layers=2
pixi run train model.decoder.joint.hidden_dim=512
# Dataset
pixi run train dataset.max_train_samples=10000
pixi run train dataset.max_eval_samples=1000
# Logging
pixi run train ~logging/wandb # Disable W&B
pixi run train logging.wandb.project=my-project # Change project name
# Checkpoints
pixi run train model.checkpoint_path=outputs/training/checkpoints/last.ckpt
| File | Mô tả |
|---|---|
conf/trainer/lightning.yaml | GPU, precision, epochs, gradient clipping, early stopping |
conf/decoder/tdt.yaml | Predictor (LSTM), Joint network, loss config |
conf/model/parakeet-encoder.yaml | Encoder freeze, projection, feature extraction |
conf/dataset/vlsp2020.yaml | Dataset path, splits, sampling rate |
# 1. SSH vào server
ssh user@your-server
# 2. Cài đặt pixi (nếu chưa có)
curl -fsSL https://pixi.sh/install.sh | bash
# 3. Clone repo
git clone <repo-url>
cd ASR
# 4. Cài đặt environment (~10-15 phút, tải PyTorch + NeMo)
pixi install
# 5. Login W&B (optional)
wandb login
# Cơ bản
pixi run train
# Với W&B logging để theo dõi từ xa
pixi run train logging.wandb.enabled=true
# Multi-GPU (nếu có nhiều GPU)
pixi run train trainer.devices=2 trainer.strategy=ddp
# Precision thấp hơn để nhanh hơn (RTX 3090 hỗ trợ FP16 tốt)
pixi run train trainer.precision="16-mixed"
# Gradient accumulation lớn hơn nếu VRAM ít
pixi run train trainer.accumulate_grad_batches=8
https://wandb.ai/your-project để xem loss, WER, CER real-timewatch -n 1 nvidia-smioutputs/training/logs/Sau khi train xong:
outputs/training/
├── checkpoints/
│ ├── epoch=10-val_wer=0.1234.ckpt
│ ├── epoch=15-val_wer=0.1123.ckpt ← best model
│ └── last.ckpt
├── logs/
└── model_config.json
pixi run test
pixi run lint # Ruff check + fix
pixi run format # Ruff format
pixi run typecheck # Pyrefly type check
# Install hooks
pre-commit install
# Run manually
pre-commit run --all-files
Project sử dụng dataset VLSP 2020 (~100 hours tiếng Việt):
doof-ferb/vlsp2020_vinai_100hconf/dataset/vlsp2020.yamlAudio (16kHz)
│
▼
┌─────────────────────────────┐
│ Parakeet Encoder (FROZEN) │
│ FastConformer, ~600M params│
│ Output: Hidden States │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ TDT Decoder (TRAIN) │
│ ┌───────────────────────┐ │
│ │ Predictor (LSTM) │ │
│ │ Output: Context │ │
│ └──────────┬────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ Joint (2-headed) │ │
│ │ ├─ Token Head │ │
│ │ └─ Duration Head │ │
│ └───────────────────────┘ │
└─────────────────────────────┘
│
▼
Tokens + Durations
Ưu điểm:
# Giảm batch size, tăng gradient accumulation
pixi run train trainer.batch_size=8 trainer.accumulate_grad_batches=8
# Dùng precision thấp hơn
pixi run train trainer.precision="16-mixed"
# Đảm bảo CUDA 12.9 và PyTorch đúng version
pixi run python -c "import torch; print(torch.__version__, torch.version.cuda)"
# Cài lại
pixi reinstall
# Giới hạn samples cho debugging
pixi run train dataset.max_train_samples=1000 dataset.max_eval_samples=100
Internal project - For internal use only.