skillfed

lhotse

Data preparation for speech processing models training.

lhotse v1.33.0 1.3M downloads/30d#4,082 on PyPI
Permissive license Apache-2.0 License Active released

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 lhotse

uv

uv add lhotse

poetry

poetry add lhotse

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Multimedia :: Sound/Audio :: SpeechTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

speech audio data preparationmultimodal dataset loadingaudio preprocessing pipelinespeech training dataaudio cut mixing augmentationefficient data loading speechaudio feature extraction
speech-processingdata-preparationmultimodal

More Python Modules packages