lhotse
Data preparation for speech processing models training.
What it is and what it does
Lhotse is a Python library for preparing multimodal data (speech, audio, video, image, text) for training machine learning models. It sits alongside k2 as part of the next-generation Kaldi speech processing ecosystem. The library introduces the concept of audio cuts—logical segments that can be mixed, truncated, and padded on-the-fly—to minimize storage while supporting flexible training data construction. It handles data randomization and de-duplication for distributed training, provides standard recipes for common corpora, and integrates with PyTorch through task-specific Dataset classes.
Lhotse supports both pre-computed feature storage (with optional compression via lilcom) and on-the-fly feature extraction and augmentation. Data and metadata are stored in human-readable text manifests and exposed through convenient Python classes. The library offers efficient sequential I/O formats (Lhotse Shar, similar to webdataset) and state-of-the-art dataloading algorithms like dataset blending and bucketing. It runs on Python 3.8+ across Linux, macOS, and Windows, with dependencies on torch, numpy, audioread, SoundFile, and other standard tools.
Use it for:
- Prepare speech recognition training datasets with on-the-fly mixing and augmentation to reduce storage overhead.
- Build multimodal pipelines combining audio, text, image, and video for end-to-end model training.
- Implement distributed multi-node training with data randomization and de-duplication across workers.
- Create standard data recipes for common speech corpora to streamline reproducible research.
- Combine multiple datasets with flexible blending and bucketing for efficient batching during training.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Lhotse prepares multimodal (speech, audio, video, image, text) data for machine learning model training with flexible pipelines, on-the-fly augmentation, and efficient data loading.
Yes. Lhotse is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, and solves a real problem in multimodal data preparation for speech and audio ML. The low install friction and permissive license make it accessible. Install it if you are building speech, audio, or multimodal training pipelines; skip it if you only need simple audio I/O without data augmentation or complex dataset orchestration.
Install
lhotse on PyPI
pip
pip install lhotseuv
uv add lhotsepoetry
poetry add lhotseInstalling lhotse
Before you install
Low friction: pure Python wheel with 11 runtime dependencies including torch, numpy, and audio libraries. Actively maintained with recent release. Requires Python 3.8 or later.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions, typical for research and production ML workflows.
Quickstart
pip install lhotse
from lhotse import CutSet, Recording, SupervisionSegment
# Load or create cuts and prepare data
cuts = CutSet.from_json('cuts.json')
for batch in cuts.to_torch():
# Use batch for training
pass
Requires torch and audio backend libraries (audioread, SoundFile). The environment variable LHOTSE_REQUIRE_TORCHAUDIO controls whether torchaudio is enforced; basic audio reading works without it via SoundFile.
Verify before relying
- Whether torchaudio is a hard requirement or optional (environment variable LHOTSE_REQUIRE_TORCHAUDIO suggests it may be optional)
- Performance characteristics when handling large-scale multimodal datasets
- Compatibility details with specific PyTorch versions beyond the general torch dependency
Package facts
| License | Apache-2.0 License (permissive) |
| Python support | supports the current Python release (>=3.8.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 11 — audioread, SoundFile, click, cytoolz, intervaltree, numpy, packaging, pyyaml, tabulate, torch, tqdm |
| Maintenance | actively maintained — 116 days since the last release |
| First released | |
| Downloads | 1,304,236/month — #4,082 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lhotse-1.33.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
openai-whisperWhisper performs multilingual speech…
permissive · top 5,000 on PyPI
torchaudioProvides PyTorch-based audio processing,…
permissive · top 5,000 on PyPI
kokoroKokoro is an inference library for the…
permissive · top 15,000 on PyPI
sileroSilero provides pre-trained text-to-speech…
permissive · top 15,000 on PyPI
speechbrainSpeechBrain is a PyTorch-based toolkit for…
permissive · top 5,000 on PyPI
mlx-audioMLX-Audio provides text-to-speech,…
permissive · top 15,000 on PyPI
kaldi-native-fbankExtracts Kaldi-compatible filterbank (fbank)…
permissive · top 15,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
omnivoiceOmniVoice generates speech from text in over…
permissive · top 15,000 on PyPI
pyannote-databaseDefines and manages reproducible experimental…
unclear · top 5,000 on PyPI