Introduction
Kaldi's HMM-GMM reimplementation with Eigen: diagonal-covariance GMMs, HMM topology and transition model, decision trees / context dependency, training-graph compilation, MLE/MAP estimation, and GMM decodables for forced alignment and decoding — from C++ and Python, without any kaldi binaries.
The decoding engine (lattice decoders, decoder wrappers, lattice best path)
lives in kaldi-decoder; this library links its C++ core and
implements its DecodableInterface / TransitionInformation.
Build
git clone https://github.com/csukuangfj/kaldi-hmm-gmm
cd kaldi-hmm-gmm
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
ctest --output-on-failure
All C++ dependencies (kaldi-decoder, kaldifst/openfst, Eigen, pybind11, googletest) are fetched automatically. To build a Python wheel instead:
python setup.py bdist_wheel
pip install dist/kaldi_hmm_gmm-*.whl
The Python package kaldi_hmm_gmm is self-contained — it does not require
the kaldi-decoder Python package at runtime.
Python API
import kaldi_hmm_gmm as khg
tm, am = khg.read_model("final.alimdl") # kaldi model format
tree = khg.read_tree("tree")
decodable = khg.DecodableAmDiagGmmScaled(am=am, tm=tm, feats=feats, scale=0.1)
cfg = khg.AlignConfig(beam=10.0, retry_beam=40.0) # kalpy/MFA defaults
num_done, num_error, _, like, frames, alignment, words = khg.align_utterance(
config=cfg, utt="utt", acoustic_scale=0.1,
transition_scale=1.0, self_loop_scale=0.1,
trans_model=tm, fst=training_graph, decodable=decodable)
See the documentation for the full API and two complete tutorials.
Examples
- yesno (
egs/yesno) — the kaldiegs/yesno/s5recipe, stage by stage: train a monophone GMM (40 iterations), build HCLG, decode, score. Run it withcd egs/yesno && ./run.sh. The corpus is the OpenSLR waves_yesno release; the script fetches the same tarball from a github.com mirror to reduce CI download time. - MFA forced alignment (
tools/align_mfa.py) — align a single utterance to its transcript with pretrained MFA acoustic models (Englishenglish_mfa, Chineseaishell3_pinyin/large_pinyin) and produce Praat TextGrids. Test audio: en.wav / zh.wav. Every run reports the audio duration, elapsed seconds and the real-time factor (RTF); the.github/workflows/mfa.yamlCI runs both languages and uploads the TextGrids next to the audio.
Both are documented in detail in the documentation (docs/source/usage/),
including environment setup (no C++ build needed — pip install kaldi-hmm-gmm) and copy-paste runnable commands.
Colab notebooks
Run the MFA examples in your browser:
Documentation
cd docs
pip install -r requirements.txt # + doxygen
make html
Then open docs/build/html/index.html. The C++ API reference is generated
by doxygen (linked from the C++ API pages) and the Python API is rendered
with autodoc.
See also
- kaldi-decoder — kaldi's
src/decoder/src/latport - kaldifst — openfst Python bindings with zero-copy interop
- kaldi-native-fbank — kaldi-compatible feature extraction
- sherpa-onnx — uses this library (C++) for GMM forced alignment
Metadata
Release files for kaldi-hmm-gmm 1.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaldi_hmm_gmm-1.3.9.tar.gz | 231.9 kB | Without provenance | Details for kaldi_hmm_gmm-1.3.9.tar.gz |
Built distributions (wheels)
Total release size: 16.4 MB
Release files / kaldi_hmm_gmm-1.3.9.tar.gz
| Download URL | kaldi_hmm_gmm-1.3.9.tar.gz |
|---|---|
| Size | 231.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca9fbc8ee8103cc860f5ca3c0a89df52dd3b99f1ea78bab023c938de19afa577
|
|
BLAKE2b-256 checksum How to use checksums |
5871c18c48308084c69900c2fbe5cd3b09958fc65680280d6601efcc9a8bc0a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.15 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
bac42f5f17445d1a85eb6d85e60410d20281fb5f64a072df46f1a7fc231552b2
|
|
BLAKE2b-256 checksum How to use checksums |
ebfffad30dbc6387d098dcc6038e3826552fa1d2b34f365b67e206e2a2c3f610
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
b30b483506abe6fd9980975c1dbac5addf761a93d61d3a363312391de077bd18
|
|
BLAKE2b-256 checksum How to use checksums |
65f920919ed99d5d14549cd5fcb8f0b0be02354d4155fd45edba69eb452682ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
dc30c2fec872caec60f8ed29d2c42e1f7fbe07994ad22bdfd8387d49936581d8
|
|
BLAKE2b-256 checksum How to use checksums |
685982e1d0c0dfcee60eee17ba0b776e5c2a48a2dd13783ba1c062870222f758
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
f116800c8c5ec17a6deb51de5169382dbe4d9feffd50ab6ae80b023b9a79ca11
|
|
BLAKE2b-256 checksum How to use checksums |
0c3c9f95b5d5f5aeb9ddf2765a9d985770ca64a7e1a38a4225441fc250490f12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ddf0ba54e44362e502dcc1ac622582b290538bb0bfff893dbabb4c0c56d3d8ac
|
|
BLAKE2b-256 checksum How to use checksums |
aa2093d17600611240f1bbe628728223c7417eda26f86310d526c0ae8e364ac9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8ed027862b2a7c6e880f7fcffbc5b302d56737c8e819b78cf3935cd20b3cdd65
|
|
BLAKE2b-256 checksum How to use checksums |
577639f7f6f088a4ebc16c4e4dd3ddd9ff13fe94288e009155347484900fd1cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d30c966736842c13b3c34d6d51e93acaf6929e4350773a8040c64230e054dce3
|
|
BLAKE2b-256 checksum How to use checksums |
ae668a573444776237be772d8e042f77b9c6b9dbb505cb3924aab8f0907699d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Release files / kaldi_hmm_gmm-1.3.9-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | kaldi_hmm_gmm-1.3.9-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
1b7149a88317f71a3609d08b82d2e1b817968bcb03965fa9967fe2f73897e900
|
|
BLAKE2b-256 checksum How to use checksums |
8cb38de065e9bfb0eb1e45be95cf2ae4661b295411889a7959586ba8dae3d18a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.14.4
|
Security for kaldi-hmm-gmm 1.3.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.