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

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

Built distributions (wheels)

Table of built distributions (wheels) for kaldi-hmm-gmm 1.3.0
File Actions
kaldi_hmm_gmm-1.3.0-cp315-cp315-win_arm64.whl CPython 3.15 CPython 3.15 Windows ARM64 Details for kaldi_hmm_gmm-1.3.0-cp315-cp315-win_arm64.whl
kaldi_hmm_gmm-1.3.0-cp314-cp314-win_arm64.whl CPython 3.14 CPython 3.14 Windows ARM64 Details for kaldi_hmm_gmm-1.3.0-cp314-cp314-win_arm64.whl
kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_x86_64.whl CPython 3.14 CPython 3.14 Android API level 24+ x86-64 Details for kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_x86_64.whl
kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_armeabi_v7a.whl CPython 3.14 CPython 3.14 Android API level 24+ ARM EABI v7a Details for kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_armeabi_v7a.whl
kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_arm64_v8a.whl CPython 3.14 CPython 3.14 Android API level 24+ ARM64 v8a Details for kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_arm64_v8a.whl
kaldi_hmm_gmm-1.3.0-cp313-cp313-win_arm64.whl CPython 3.13 CPython 3.13 Windows ARM64 Details for kaldi_hmm_gmm-1.3.0-cp313-cp313-win_arm64.whl
kaldi_hmm_gmm-1.3.0-cp312-cp312-win_arm64.whl CPython 3.12 CPython 3.12 Windows ARM64 Details for kaldi_hmm_gmm-1.3.0-cp312-cp312-win_arm64.whl
kaldi_hmm_gmm-1.3.0-cp311-cp311-win_arm64.whl CPython 3.11 CPython 3.11 Windows ARM64 Details for kaldi_hmm_gmm-1.3.0-cp311-cp311-win_arm64.whl

Total release size: 20.0 MB

Release files / kaldi_hmm_gmm-1.3.0-cp315-cp315-win_arm64.whl

Download URL kaldi_hmm_gmm-1.3.0-cp315-cp315-win_arm64.whl
Size 3.1 MB
Tags CPython 3.15 Windows ARM64
SHA-256 checksum
How to use checksums
029e98229a1697582d61121973d18d8701d42d81acf5606398fa130df7675385
BLAKE2b-256 checksum
How to use checksums
a08aa39189bd19e1db19d5a7e86b9bb2b3c65b88c28f1027bcb7e259cda3ca82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.15.2

Release files / kaldi_hmm_gmm-1.3.0-cp314-cp314-win_arm64.whl

Download URL kaldi_hmm_gmm-1.3.0-cp314-cp314-win_arm64.whl
Size 3.1 MB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
44fb09106523bcc55437c0661b1bc618b0dfe2a57c1bb75ff5cc65eff163fbb5
BLAKE2b-256 checksum
How to use checksums
09a654cda792e5b276a662bc5493bf731a18d1b130d85686d2484fb25d05ff81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.14.10

Release files / kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_x86_64.whl

Download URL kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_x86_64.whl
Size 1.7 MB
Tags Android API level 24+ x86-64 CPython 3.14
SHA-256 checksum
How to use checksums
cedc9118f5a3f72a505f9ec4505803436479662c0ee1cad28fd19ee47f9834c9
BLAKE2b-256 checksum
How to use checksums
3b0f1e88faaedec80670fab9e1aa86d981a442172c3df74ec148c207513c4396
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.0-cp314-cp314-android_24_armeabi_v7a.whl

Download URL kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_armeabi_v7a.whl
Size 1.5 MB
Tags Android API level 24+ ARM EABI v7a CPython 3.14
SHA-256 checksum
How to use checksums
742ddb8b4b0d63bff7ec217d72cd637ae9a88e2fdf624a0108b756401cc06cf7
BLAKE2b-256 checksum
How to use checksums
897d2ab57fecb2a4af90229069fac399f760ec28079e5b965b335dcfa4c96083
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.0-cp314-cp314-android_24_arm64_v8a.whl

Download URL kaldi_hmm_gmm-1.3.0-cp314-cp314-android_24_arm64_v8a.whl
Size 1.6 MB
Tags Android API level 24+ ARM64 v8a CPython 3.14
SHA-256 checksum
How to use checksums
e25062ace2c77c7d353592a2becac1d0e6496b834d12a3f2d4c1630591b764df
BLAKE2b-256 checksum
How to use checksums
d50ce0560ca06ef34284b658257bcdc42616608ace14eb9ba87d12c27d3e3bd3
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.0-cp313-cp313-win_arm64.whl

Download URL kaldi_hmm_gmm-1.3.0-cp313-cp313-win_arm64.whl
Size 3.0 MB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
d37cced20e666ee7fd3749a4af27f515e63fca8af5bd53e9ad481a1e67e02415
BLAKE2b-256 checksum
How to use checksums
a2ef1af698c72da548ac8ca9b8297430b1027596a4bc39326e71623414c2607b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.13.17

Release files / kaldi_hmm_gmm-1.3.0-cp312-cp312-win_arm64.whl

Download URL kaldi_hmm_gmm-1.3.0-cp312-cp312-win_arm64.whl
Size 3.0 MB
Tags CPython 3.12 Windows ARM64
SHA-256 checksum
How to use checksums
5d3128a6877b667b125258ae35119f0ae2c43a62201209d410cf207dba819745
BLAKE2b-256 checksum
How to use checksums
efeb62156592c08126481796fca389d089230abf66b426e807be8d72947ff72c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.10

Release files / kaldi_hmm_gmm-1.3.0-cp311-cp311-win_arm64.whl

Download URL kaldi_hmm_gmm-1.3.0-cp311-cp311-win_arm64.whl
Size 3.0 MB
Tags CPython 3.11 Windows ARM64
SHA-256 checksum
How to use checksums
23928498629402967ef3b852d4cb8b67f775e0f20f098e97ee28537125cde397
BLAKE2b-256 checksum
How to use checksums
5de4ef56b384667f6981121677f7f428ad37b66160a4a5f681a8f4f3347e6776
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Security for kaldi-hmm-gmm 1.3.0

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