Skip to main content

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 kaldi egs/yesno/s5 recipe, stage by stage: train a monophone GMM (40 iterations), build HCLG, decode, score. Run it with cd 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 (English english_mfa, Chinese aishell3_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.yaml CI 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:

  • MFA forced alignment — English Open In Colab
  • MFA forced alignment — Chinese Open In Colab

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

Metadata

Release files for kaldi-hmm-gmm 1.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kaldi-hmm-gmm 1.3.8
File Size Uploaded Provenance Actions
kaldi_hmm_gmm-1.3.8.tar.gz 231.7 kB Without provenance Details for kaldi_hmm_gmm-1.3.8.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kaldi-hmm-gmm 1.3.8
File Actions
kaldi_hmm_gmm-1.3.8-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.8-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.8-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.8-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details for kaldi_hmm_gmm-1.3.8-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Total release size: 16.4 MB

Release files / kaldi_hmm_gmm-1.3.8.tar.gz

Download URL kaldi_hmm_gmm-1.3.8.tar.gz
Size 231.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d9426713f6f4cfb71d9189030a1937699e654b05315ee8a32434e8ddfed4a671
BLAKE2b-256 checksum
How to use checksums
b238de209b8513a81f5666119fd10f03315aab0a97799a62bb4c23c36f40f355
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.8-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
1252bf10e73918c2fae7a2102c3d60f747a92e51174138b30636022e8e269e99
BLAKE2b-256 checksum
How to use checksums
d73d7c13d255e982bf66d4a20cebe5298d9848178da1b538ebbe5d55760ab4e4
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.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
79aa4ac175f7f1009ef8d48a5f5227dc406d61d76df02777b75286b98c671eda
BLAKE2b-256 checksum
How to use checksums
2a8e93b1d25c716ee84f50e312d3a02199a3a59a0e985bdbf09c918a626f50cd
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.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
bcc9dee4df0597265ea5ef9435666f32dab7f4954f59e1409a182cb6fa211302
BLAKE2b-256 checksum
How to use checksums
21762679231edaa1deea03044e027c362a4327d46db052aa2d5c4e57129a108b
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.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
f6cf9ecb14c6ebaee97a0092fd4b958960839f2c7265dee621249f20ad15be65
BLAKE2b-256 checksum
How to use checksums
0000c85b4bf7326a9f3c8e3493dcacc664f6745261f97b71c7d45621c8e5909f
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.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
eff813358160817af859bceb20abfee023597b6d7c0752dae6bc02130a17d3a1
BLAKE2b-256 checksum
How to use checksums
a7fcfd4cedfeaadcaee2b782d56997f834d6c3438d1027a5761c7777b2914c0f
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.8-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
ed9a365a3fe9b1970e553963df0e067a8a3ac496408c42894f73040120c9397f
BLAKE2b-256 checksum
How to use checksums
c5c3e107af09ddf09605523bd5db3a09a07327c14b8fa0c8d6112149394c8247
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.8-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
c3ea21f581766e57317c24036f6bfba9ed9b9684c6a1cf11aa45190139cf9006
BLAKE2b-256 checksum
How to use checksums
fac67fa42cdd0cfcd1d6cd57896f4a44518608a1619ebc8775deea647f0df5da
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.8-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.8-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
0d636eccd5608aef85f093d1a233d24fa6dcb1a47cf34a9984501c173041cd35
BLAKE2b-256 checksum
How to use checksums
1249b209490b0759578acfc9f3ccd21c9f0721cb40d4dfb4fe20f1c2b6fe0698
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.8

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page