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.7

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.7
File Size Uploaded Provenance Actions
kaldi_hmm_gmm-1.3.7.tar.gz 231.5 kB Without provenance Details for kaldi_hmm_gmm-1.3.7.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kaldi-hmm-gmm 1.3.7
File Actions
kaldi_hmm_gmm-1.3.7-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.7-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.7-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.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.7-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.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.7-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.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.7-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.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.7-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.7-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.7-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.7-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kaldi_hmm_gmm-1.3.7-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.7-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Total release size: 16.4 MB

Release files / kaldi_hmm_gmm-1.3.7.tar.gz

Download URL kaldi_hmm_gmm-1.3.7.tar.gz
Size 231.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b32222edb89e2d9de8458e7347df0823c5529c97df50be04fdb1ff22e8a95eed
BLAKE2b-256 checksum
How to use checksums
76d28568af6ab412eccae2ff7c406bc003a69a94c71e66a80c6c1a534eb2c770
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.7-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
28610b3de105077ac61f4d1ee70b46f4562627aa2037b5e44d65987ef625afac
BLAKE2b-256 checksum
How to use checksums
f56eaf865c93c5dca72e19ddcf029ec2e2c81ac0d594d6521ef5ce8b750b2f56
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.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
9d9da5593044a4f38624318608a385b0cef306f4c429e0b1694df2716ec17ab5
BLAKE2b-256 checksum
How to use checksums
ca774b438d4e7bbb1a8c26809361734c55b95482461a03f71241c5e764a073b0
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.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
3632873ce67722481437ad256362d2b610341ca90de7ee23069a445248baac7b
BLAKE2b-256 checksum
How to use checksums
a5ccf78a69a125d6b690be2fb02f609a93dfe2957f7ab18a81df7ab1c5dab819
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.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
f875529ff41c05efe3e6d8701dbb179d2e48a067561f91f0ec9799f9b74bceeb
BLAKE2b-256 checksum
How to use checksums
fcb1e40a0518af63a40ca1ab3284aba2284f32b862abf0ef76543c67edc47a9b
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.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
04e56913f0790bddc273c8936b488f037f07222fe5095cebd4b5b38745c9ae22
BLAKE2b-256 checksum
How to use checksums
1854d01923047cb594d448d701bde91af0746852c19e3c37bcea486116b23b4c
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.7-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
3c2c28cdbd301e63bea7fcfc47443719082017c159fbde7a586d870c3d9979a2
BLAKE2b-256 checksum
How to use checksums
9938c5890e36438a76babb75223c281f9fe06dd9ec4fa2e3d9d305efaa4b6a7c
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.7-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
7cbd1a0b0c7bc3c8a4043076f3296e005296ac463c43201ac0d8b1da6aef38d9
BLAKE2b-256 checksum
How to use checksums
e1dbef73b79af234f49c3b4fa1f0ba0e8cf80bd78b1dce8192a0609fcae9750e
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.7-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.7-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
c66b1ac1c4fb0e618ae4cdf4f3dd38efda403842e13b555a51caca510710e3ee
BLAKE2b-256 checksum
How to use checksums
f57f288a72f0c8a115c021c913aa4e52edd46a8b7d3f65b1a6487637c7ce9ddb
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.7

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