Fine-tune a Wav2Vec2 acoustic model on the LJSpeech dataset using CTC, then export it to ONNX for inference.
Requirements
Python >= 3.10
A CUDA-capable GPU is recommended for training
Install dependencies:
pip install -e .
Training
Fine-tune facebook/wav2vec2-base on LJSpeech (5% held out for eval). Training takes ~10 epochs by default and writes checkpoints to wav2vec2-ljspeech/.
python train.py
Key settings live at the top of train.py:
Constant
Default
Purpose
MODEL_ID
facebook/wav2vec2-base
Pre-trained wav2vec2 checkpoint
DATASET_ID
lj_speech
HuggingFace dataset id
Training hyperparameters (batch size, epochs, learning rate, etc.) are configured through TrainingArguments inside train.py.
Monitor progress with TensorBoard:
tensorboard --logdir wav2vec2-ljspeech
ONNX Export
Export the trained checkpoint to ONNX and validate it with ONNX Runtime: