Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 23 min read How-to mediumAdept

Fine-Tune XLSR-Wav2Vec2 for low-resource ASR with 🤗 Transformers

XLS-R, the multilingual successor to Wav2Vec2 pre-trained on roughly half a million hours of audio in 128 languages, can be fine-tuned for speech recognition by adding a linear layer on top and training with Connectionist Temporal Classification (CTC). The walkthrough fine-tunes the 300M-parameter checkpoint on about 4 hours of Turkish Common Voice data using 🤗 Transformers and Datasets. It covers text normalization (stripping punctuation, lowercasing, replacing hatted characters), building a character-level vocabulary with word-delimiter, unknown and CTC blank/padding tokens, and setting up the Wav2Vec2CTCTokenizer and feature extractor, with word error rate as the evaluation metric.

Assumes: PyTorch basicsTransformer modelsCTC loss basics

Related posts

  • Fine-Tune Wav2Vec2 for English ASR in Hugging Face with 🤗 Transformers

    Hugging Face mediumAdept

    Wav2Vec2, pretrained with a contrastive masked objective on 50k+ hours of unlabeled speech, can be fine-tuned with CTC on small labeled datasets for end-to-end English ASR without a language model. The walkthrough fine-tunes the base checkpoint on the 5-hour Timit corpus using 🤗 Transformers and Datasets. It covers building a character-level CTC vocabulary (lowercasing, stripping punctuation, keeping apostrophes, mapping space to a word delimiter, and adding UNK and PAD/blank tokens), and configuring the feature extractor with a matching 16kHz sampling rate and normalization. It also explains why the base checkpoint works better without an attention mask, and evaluates with WER via jiwer while pushing checkpoints to the Hub.

  • Fine-Tune Whisper For Multilingual ASR with 🤗 Transformers

    Hugging Face mediumAdept

    Whisper, OpenAI's encoder-decoder ASR model pre-trained on 680,000 hours of labelled audio, can be fine-tuned for a low-resource language with Hugging Face Transformers using only about 8 hours of data. The walkthrough fine-tunes the multilingual small checkpoint (244M params) on Hindi from Common Voice 11. It covers loading and trimming the dataset, then preparing data with WhisperFeatureExtractor, which resamples to 16kHz, pads or truncates to 30s and converts audio to log-Mel spectrograms, plus WhisperTokenizer. It then moves through training and WER evaluation and ends with a Gradio demo. Along the way it explains why supervised pre-training needs less fine-tuning than Wav2Vec 2.0 and why Whisper needs no attention mask.

  • Fine-Tune W2V2-Bert for low-resource ASR with 🤗 Transformers

    Hugging Face mediumAdept

    Wav2Vec2-BERT (facebook/w2v-bert-2.0), a 580M-parameter audio model pre-trained on 4.5M hours across 143+ languages, can be fine-tuned with CTC for ASR in low-resource languages using Hugging Face Transformers, demonstrated on ~14h of Mongolian Common Voice 16.0 data. The walkthrough covers text normalization, building a character vocabulary (dropping Latin characters and punctuation), the Wav2Vec2CTCTokenizer and SeamlessM4TFeatureExtractor, training, and tips for scaling CTC training. Compared with Whisper-large-v3 after similar fine-tuning, it reaches similar WER on Mongolian while running 10-30x faster and being 2.5x more resource-efficient, because it decodes in a single non-autoregressive pass and adapts to any alphabet.

  • Fine-Tune MMS Adapter Models for low-resource ASR

    Hugging Face mediumAdept

    MMS adapter training fine-tunes only about 2.5M language-specific adapter weights on Meta's mms-1b-all checkpoint, reaching low word error rates after 10-20 minutes of training on small datasets. The walkthrough uses Turkish Common Voice 6.1, which has about 4 hours of data, to build a character-level CTC tokenizer. Preprocessing strips punctuation and normalizes accented characters before training with Hugging Face Transformers. For low-resource languages, adapter training is recommended over full fine-tuning because it uses less memory, is more robust and performs better. Full fine-tuning can still win for medium- and high-resource languages.

  • Speech Synthesis, Recognition, and More With SpeechT5

    Hugging Face mediumAdept

    SpeechT5, Microsoft Research Asia's unified speech model, is now in 🤗 Transformers. It uses one shared Transformer encoder-decoder with task-specific pre-nets and post-nets to handle text-to-speech, speech-to-text and speech-to-speech. The model is pre-trained jointly on text and speech so both share one hidden representation space, then fine-tuned per task. Code walkthroughs cover TTS with x-vector speaker embeddings and a HiFi-GAN vocoder, voice conversion, and character-level ASR without punctuation, and they flag limits such as voice conversion sometimes cutting off early at pauses.

The quest for software engineering knowledge.

Look:
Layout: