Python wrapper for Kaldi
Project description
pydrobert-kaldi
Some Kaldi bindings for Python. I started this project because I wanted to seamlessly incorporate Kaldi's I/O mechanism into the gamut of Python-based data science packages (e.g. Theano, Tensorflow, CNTK, PyTorch, etc.). The code base is expanding to wrap more of Kaldi's feature processing and mathematical functions, but is unlikely to include modelling or decoding.
Eventually, I plan on adding hooks for Kaldi audio features and pre-/post- processing. However, I have no plans on porting any code involving modelling or decoding.
This is student-driven code, so don't expect a stable API. I'll try to use semantic versioning, but the best way to keep functionality stable is by forking.
Documentation
Input/Output
Most I/O can be performed with the pydrobert.kaldi.io.open function:
from pydrobert.kaldi import io
with io.open('scp:foo.scp', 'bm') as f:
for matrix in f:
...
open is a factory function that determines the appropriate underlying stream
to open, much like Python's built-in open. The data types we can read (here,
a BaseMatrix) are listed in pydrobert.kaldi.io.enums.KaldiDataType. Big
data types, like matrices and vectors, are piped into Numpy arrays. Passing an
extended filename (e.g. paths to files on discs, '-' for stdin/stdout,
'gzip -c a.ark.gz |', etc.) opens a stream from which data types can be read
one-by-one and in the order they were written. Alternatively, prepending the
extended filename with 'ark[,[option_a[,option_b...]]:' or 'scp[,...]:' and
specifying a data type allows one to open a Kaldi table for iterator-like
sequential reading (mode='r'), dict-like random access reading (mode='r+'),
or writing (mode='w'). For more information on the open function, consult the
docstring.
The submodule pydrobert.kaldi.io.corpus contains useful wrappers around Kaldi
I/O to serve up batches of data to, say, a neural network:
train = ShuffledData('scp:feats.scp', 'scp:labels.scp', batch_size=10)
for feat_batch, label_batch in train:
...
Logging and CLI
By default, Kaldi error, warning, and critical messages are piped to standard
error. The pydrobert.kaldi.logging submodule provides hooks into python's
native logging interface: the logging module. The :class:KaldiLogger can
handle stack traces from Kaldi C++ code, and there are a variety of decorators
to finagle the kaldi logging patterns to python logging patterns, or vice
versa.
You'd likely want to explicitly handle logging when creating new kaldi-style
commands for command line. pydrobert.kaldi.io.argparse provides
:class:KaldiParser, an :class:ArgumentParser tailored to Kaldi
inputs/outputs. It is used by a few command-line entry points added by this
package. See the Command-Line
Interface page for
details.
Installation
Prepackaged binaries of tagged versions of pydrobert-kaldi are available for
most 64-bit platforms (Windows, Glibc Linux, OSX) and most active Python
versions (3.7-3.11) on both conda and
PyPI.
To install via conda-forge
conda install -c conda-forge pydrobert-kaldi
If you only want to rely on Anaconda depenedencies, you can install from the
sdrobert channel instead. There is not yet a 3.11 build there.
To install via PyPI
pip install pydrobert-kaldi
You can also try building the cutting-edge version. To do so, you'll need to first install SWIG 4.0 and an appropriate C++ compiler, then
pip install git+https://github.com/sdrobert/pydrobert-kaldi.git
The current version does not require a BLAS install, though it likely will in the future as more is wrapped.
License
This code is licensed under Apache 2.0.
Code found under the src/ directory has been primarily copied from Kaldi.
setup.py is also strongly influenced by Kaldi's build configuration. Kaldi is
also covered by the Apache 2.0 license; its specific license file was copied
into src/COPYING_Kaldi_Project to live among its fellows.
How to Cite
Please see the pydrobert page for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydrobert_kaldi-0.6.4.tar.gz.
File metadata
- Download URL: pydrobert_kaldi-0.6.4.tar.gz
- Upload date:
- Size: 436.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99716a97bd03c197ea9bcdfc71044691d4a2fb66d17b38ba2bb6616f8ecc9e1e
|
|
| MD5 |
3e7262936f30e6cc49a7c485a23a135c
|
|
| BLAKE2b-256 |
43d6dbd04b716c06b6ada0854b336cade35c7f3944317c7d23726e67b3f91473
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 691.7 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a138b216d90bb27b79e20e5b386e631fae79d87392607451ac56444f8cd0be
|
|
| MD5 |
b528d8e16f26a152087525419faba474
|
|
| BLAKE2b-256 |
c313da6d990f9b1e256af2c8acb6c1a56edd3532888e8b6566ebfb124b3d7491
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp313-cp313-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 11.4 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1f87b3be5975b88ec08f22ceca3efaccd3d81533acb503eee68a4fea4bf16c2
|
|
| MD5 |
4dc81a3ea696276a8b22260caa3b5959
|
|
| BLAKE2b-256 |
70ed28bae8d312bbaa2e746353c416938ac541b68abb0e931adfe909c9a9720f
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 11.1 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcd6368fefd73d258a9086f22514d9f8684793bc3739f0cf258c90c6c6492e33
|
|
| MD5 |
c270a0cf7f667b576eae9db685640daf
|
|
| BLAKE2b-256 |
7a2b67e99c5593555844c5842f6787bdc486d1bbe82b739ed564a110dd68ce07
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3baa6ebcd9ab34b5fd3b95f4e71cdda881d380810ad715bb8365f50e10a3e49e
|
|
| MD5 |
a0587caa1837dbcd11779259bf26532a
|
|
| BLAKE2b-256 |
ffb366ccd702072a63722433f586543f5fb3660ed0c63fba29c4cef8ca1326d6
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 691.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a967c96bf52d14cc241b180b09568f4cf9e37cd8fdd03c4de404bd783625c49f
|
|
| MD5 |
284b07ae6029cadeb264cf7d64383433
|
|
| BLAKE2b-256 |
2e8f30fb140217fa5de1c5390d312179435eff6eee6b9b2e869491624b63d206
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp312-cp312-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 11.4 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dcebb74d0363c9a994ba5b9db361760212c2b6ff31c5b969d7c500c101ee41b
|
|
| MD5 |
951ac26d62dd5eec5c4268cfab20dec9
|
|
| BLAKE2b-256 |
215115ac664d804cc974dd7c76ac8d75eb37facc08268f6f97137cef72ac600d
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 11.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8485d482bdb88f9bbd094de8b172ec24b876ef164cafc7d8cb7c26940e2462ed
|
|
| MD5 |
fa47af42e90fab421d54558e5acd8f92
|
|
| BLAKE2b-256 |
1ca016c054503f75dec25437a8f517ac127518a3c0a352f9934d5089bd72fb83
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a180f6a68c5799c4b1e722636051be1124136f8ec22fbff90187abf2a5d3cf8
|
|
| MD5 |
478d68c9d5c8fefc635a973fcc8bf3f4
|
|
| BLAKE2b-256 |
eaf979738139efc846c0a15a8cfab043d26131c955d2c387b4df5e29bd2a23c2
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 691.1 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dcb102185412a4fdd60801ac6088162e3ca1118e6ac765e22627f7f663ca0ae
|
|
| MD5 |
4453028d5b89a64016356b774b304e0e
|
|
| BLAKE2b-256 |
0af2a60261b174470bd5320eeb20a3929aa164093b3752e077b47927b15362c9
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp311-cp311-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp311-cp311-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 11.3 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b44a0c427028bae5534f8a23148467c53583559ea2a857af3cafd7b5987cb55
|
|
| MD5 |
d1cd6df7bd4c8c74ffdc0fcdae696267
|
|
| BLAKE2b-256 |
9a0005e9be3125249aa9cca7e8e8f602346dcfe4adc1f5eec34eadece4939a23
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 11.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
210641407946f9e2d5f2b4fe792126e739753724c81512fabf43b501c1e1b3a1
|
|
| MD5 |
91398b9c2c87e4ee504bf6306f3aa0c2
|
|
| BLAKE2b-256 |
b6ec8e28111263a1c763a1984d006490c0e240fb50f206301a7c9ef08019d686
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2de810e7148859b63cdee8d0885d9a93e7dadad70aeb51b8db23e60f3de58c20
|
|
| MD5 |
a7daa276bbd8c50d8c8eda873f252acc
|
|
| BLAKE2b-256 |
04c5bc6f942cdba4db9e729cc586d1838ce9e74104ec1efc6f91768075bf2246
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 691.1 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
185c663fcbd11b5f53eaff71c4de378e22d9e012fa9ca90a6bec72fbf0ddd86d
|
|
| MD5 |
223906e3c14297fde5a3f396e689c6f6
|
|
| BLAKE2b-256 |
a8e94892e2ea8171750451fc684d405459aa82e355c3fcf14a40fa89e6304e01
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp310-cp310-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp310-cp310-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 11.3 MB
- Tags: CPython 3.10, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee781ecb4567991abeebed4859578361545b6b50c896310252a1665b0324b85b
|
|
| MD5 |
e6581caa970b9cb86c9e77e7cd539261
|
|
| BLAKE2b-256 |
91e54bd149112e61e34105eed680f93030f56c05d5041e6baf7a1d6551cdf57b
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 11.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d598a884276593f7ebbbbce928c5fe3e16fb9ff058c53c2269c1a1bd7c100e9
|
|
| MD5 |
fff735433c4638967b2c53a442c89b8d
|
|
| BLAKE2b-256 |
9117ae2b3372fbd776c0867ce2a366c133695d6215d2eeb02c1a2f045485b4ae
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f90acff83e1b32b66fc8d4cef428a9d37c481c4678877fdd70c7dec97a7455ef
|
|
| MD5 |
f43c99396359d9dda4304dbb530b377c
|
|
| BLAKE2b-256 |
22c61fe2d5b6df3fbe01987beeac2faa3634246e861f2ad525c7d13a5343fa97
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 691.7 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d8fdee57260195e9cbe438a0993a0562b8059b4ac9daa9a4d62632782b66351
|
|
| MD5 |
b257f6ec8aaba02e1b50cde07661d544
|
|
| BLAKE2b-256 |
653a65b22bab01ae2e328b62e7806049d21f27df4ad8ca512ee5199bba1c40a9
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp39-cp39-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp39-cp39-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 11.3 MB
- Tags: CPython 3.9, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
994a85ea4941a21fdb64d9665b71e4f46b9cae649b37656768a8febc00253246
|
|
| MD5 |
b68001f049611e3b9348a5c694928adf
|
|
| BLAKE2b-256 |
e94c8313e367033d916332813df88a3739881bf7408910824428cce6ed5db6c8
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 11.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b1ae1f955c592e5cb577d1592529b7c4ef81d6ff366869129075c4af4f84689
|
|
| MD5 |
d0cc34f10c7f47faec64c49bb5b54828
|
|
| BLAKE2b-256 |
f7c7b923b9f3cae6cdd49de6d9ba074ab80ef7e0bc1a7b2bcdd6e1d86c440533
|
File details
Details for the file pydrobert_kaldi-0.6.4-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydrobert_kaldi-0.6.4-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
831e122c1127af388e58f50479e5ee8df71b0ffed452a7d46d3aad530b8fa20c
|
|
| MD5 |
1f066a1e2ed74a17d90f358cbe1125b1
|
|
| BLAKE2b-256 |
c02588aaeba11cb7541f13f3bb4c32eb08a3a7706929596435d8b443824c0633
|