Instructions to use chaos24/montreal_forced_aligner_bangla with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Montreal Forced Aligner
How to use chaos24/montreal_forced_aligner_bangla with Montreal Forced Aligner:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
You need to agree to share your Hugging Face information to access this model
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
This model is released under CC BY-SA 4.0 and is derived from OpenSLR Bengali speech data. By requesting access you agree to use it under that license, to credit the authors, and to share adaptations under the same license.
Log in or Sign Up to review the conditions and access this model content.
Bangla (Bengali) Forced Aligner — Montreal Forced Aligner
A Montreal Forced Aligner (MFA) acoustic model, G2P model and pronunciation dictionary for Bengali, trained on OpenSLR Bengali speech data. Give it a 16 kHz-ish wav and its Bengali transcript; get back a Praat TextGrid with word and phone (IPA) boundaries.
What this is not: it is not a speech recognizer. It needs the transcript and only finds when each word/phone was said.
Contents
| Path | What | Size |
|---|---|---|
models/bangla_acoustic.zip |
Acoustic model (Kaldi GMM-HMM) | ~61 MB |
models/bangla_g2p.zip |
Grapheme→phoneme model (pynini FST) for out-of-dictionary words | ~1.3 MB |
dict/bangla_full.dict |
≈64.8k-entry pronunciation dictionary (IPA, tab-separated) | ~2.9 MB |
mfa_src/ |
MFA 3.4.1 source with one bug fix in align_one (see below) |
~2 MB |
align.py |
One-file CLI/function: G2P for OOVs → merge dict → align | |
tests/smoke_test.py |
Install/pipeline check | |
environment.yml, requirements.txt |
Reproducible environment |
Model details
| Architecture | GMM-HMM: monophone → triphone → LDA+MLLT → SAT (CPU only, no GPU needed) |
| Training data | OpenSLR Bengali subset: 19,965 utterances, 508 speakers, ≈19.6 h |
| Features | 13 MFCC, 25 ms window / 10 ms shift, 16 kHz |
| Phone set | 81 IPA phones (aspirated, geminate ː, nasalized, dental ̪, affricates, …) + sil, spn |
| MFA version | 3.4.1 (trained 2026-07-09) |
| Tokenization | whitespace-separated words (MFA language tag unknown) |
| Output | TextGrid with words and phones tiers |
Installation
Kaldi is not on PyPI, so it comes from conda-forge. Linux / macOS / WSL2 only (conda-forge has no Windows Kaldi build — on Windows use WSL2).
git clone https://huggingface.co/chaos24/montreal_forced_aligner_bangla
cd montreal_forced_aligner_bangla
# (models are stored with git-lfs: `git lfs install` before cloning)
conda env create -f environment.yml
conda activate mfa_infer
pip install -e ./mfa_src
mfa version # should print 3.4.1
Manual equivalent:
conda create -n mfa_infer python=3.11 -c conda-forge -y
conda activate mfa_infer
conda install -c conda-forge "kaldi=*=*cpu*" kalpy pynini -y
pip install -r requirements.txt
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MONTREAL_FORCED_ALIGNER=3.4.1
pip install -e ./mfa_src
Why these specifics:
kaldi=*=*cpu*— without it conda may pick a CUDA build that has no matchingkalpy, which then silently fails to install.kalpy/pyninifrom conda — the pip versions compile from source and need a full C++ toolchain.SETUPTOOLS_SCM_PRETEND_VERSION_…—mfa_srcis not a git checkout, sosetuptools_scmcan't find a version. (environment.ymlsets it automatically onconda activate.)
Quick start
python align.py my_audio.wav my_audio.lab out/my_audio.TextGrid
my_audio.labis a UTF-8 text file with the Bengali transcript (whitespace-separated words).align.pyfirst runs G2P on any word missing frombangla_full.dict, merges those pronunciations with the dictionary in a temp dir, then callsmfa align_one.
From Python:
from align import align_one
align_one("my_audio.wav", "my_audio.lab", "out/my_audio.TextGrid", beam=100, retry_beam=400)
Step by step: align and verify a real recording
- Activate the environment from the Installation section (
conda activate mfa_infer). - Prepare two files with the same name:
talk.wav(mono speech) andtalk.lab(UTF-8 Bengali transcript, numbers written as words). - Run:
python align.py talk.wav talk.lab out/talk.TextGrid - Open
talk.wavandout/talk.TextGridtogether in Praat (Open → Read from file, select both, View & Edit). - Play a few words and confirm the boundaries on the
wordstier match what you hear; check thephonestier forspn(unaligned) segments. - If alignment fails, raise
--beam/--retry_beam(see Tuning--beam).
Batch, no database (simple)
Put name.wav + name.lab pairs in a folder (subfolders are fine):
python align.py corpus_dir out_dir --beam 100 --retry_beam 400
Files are aligned one after another; a file that fails is listed at the end and does not stop the run.
Each file pays a few seconds of start-up cost, so for thousands of files use mfa align below (parallel).
Batch of many files (mfa align, needs PostgreSQL)
mfa align tracks state in a PostgreSQL DB that MFA manages itself. Corpus layout: name.wav + name.lab side by side.
pip install psycopg2-binary
mfa server init # once
mfa server start # each session
mfa g2p /path/corpus models/bangla_g2p.zip /tmp/new_words.dict --clean
cat dict/bangla_full.dict /tmp/new_words.dict | sort -u > /tmp/job.dict
mfa align /path/corpus /tmp/job.dict models/bangla_acoustic.zip /path/out \
--beam 40 --retry_beam 160 --clean
For one file at a time prefer align_one (no DB).
Using the Hugging Face Hub
from huggingface_hub import snapshot_download
path = snapshot_download("chaos24/montreal_forced_aligner_bangla")
# then: python {path}/align.py ...
Tuning --beam
If MFA reports an alignment failure (e.g. "Could not align"), raise the beam:
| Audio | --beam / --retry_beam |
|---|---|
| short, clean | 40 / 160 |
| typical | 100 / 400 |
| long or noisy | 200 / 800, up to ~1200 |
If even a huge beam fails, the transcript almost certainly doesn't match the audio (wrong text, missing speech, music/IVR, wrong language). Raising the beam further won't fix that.
Known limitations
- Digits (
10,৫০০) cannot align: there is no letter-to-sound rule for digit glyphs, so they become<unk>/spn. Verbalize numbers into Bengali words first. spnphone = unaligned blob, whatever the word tier says. Check the phones tier when judging quality.- Dictionary covers the training vocabulary only; other words rely on G2P (lower accuracy than dictionary entries).
- Accuracy on audio unlike the training data (noisy, telephone, spontaneous speech) may be lower and may need a larger beam.
- Use mono speech; the model's features are 16 kHz.
- English/code-switched words need Bengali-script transcription (or they fall to G2P/
spn).
The align_one patch in mfa_src
mfa_src/montreal_forced_aligner/online/alignment.py (lines 35-36, in tokenize_utterance_text) adds a guard:
if the G2P model has no rewriter, it is ignored instead of crashing align_one. Everything else is stock MFA 3.4.1; mfa_src/bin/mfa_update is only there because setup.cfg lists it in scripts=.
Verify your install
python tests/smoke_test.py # prints SMOKE TEST PASSED if MFA, the models and G2P work
To judge alignment quality, follow Step by step: align and verify a real recording above.
Acknowledgements & licenses
- Montreal Forced Aligner — MIT (
mfa_src/LICENSE). - Training audio/transcripts: OpenSLR Bengali corpus (CC BY-SA 4.0). These models are derived from it and are released under CC BY-SA 4.0: give credit, and share adaptations under the same license.
Citation
@inproceedings{mcauliffe2017montreal,
title = {Montreal Forced Aligner: Trainable Text-Speech Alignment Using Kaldi},
author = {McAuliffe, Michael and Socolof, Michaela and Mihuc, Sarah and Wagner, Michael and Sonderegger, Morgan},
booktitle = {Interspeech},
year = {2017}
}
- Downloads last month
- -