0.5 - Ice Melt
New features:
Major overhaul of support for PyTorch Dataset API (#194 #197 #202)
Lhotse now implements a number of PyTorch datasets and samplers. The core features are:
- familiar API (map-style datasets and cut samplers that work with standard
DataLoader) - dynamic batch size, chosen based on constraints such as
max_frames - bucketing or cut concatenation as strategies for avoiding too much padding
- optional noise padding (using
CutMixtransform) - our samplers work with DDP training out-of-the-box (no need for
DistributedSampler) - More details available at: https://lhotse.readthedocs.io/en/latest/datasets.html
Example code:
from torch.utils.data import DataLoader
from lhotse.dataset import SpeechRecognitionDataset, SingleCutSampler
cuts = CutSet(...)
dset = SpeechRecognitionDataset(cuts)
sampler = SingleCutSampler(cuts, max_frames=50000)
# Dataset performs batching by itself, so we have to indicate that
# to the DataLoader with batch_size=None
dloader = DataLoader(dset, sampler=sampler, batch_size=None, num_workers=1)
for batch in dloader:
... # process dataLazy (on-the-fly) resampling on Recording/RecordingSet (#185)
The resampling is performed at the moment of reading the audio samples from disk. It automatically adjusts the duration/num_samples in the data manifest.
recording = recording.resample(22050)
recording_set = recording_set.resample(8000)New corpora:
General improvements:
CutSet.subset()gotfirstandlastarguments (like Kaldi'ssubset_data_dir.sh) and a CLI mode (#188)CutSet.from_manifest()creates deterministic Cut IDs by default (#186)- Padding cuts with arbitrary user specified values (now also works with custom feature extractors) (#187)
- Improved code coverage measurements (now excludes test code and recipe code) (#191 #192)
- Improved support for sampling rates other than 8k and 16k (#190 #195)
- Documentation build fixes (#196)
- Fixes in NSC recipe (#199)
- Fixes in ASR dataset validation (#204)