Skip to main content

Overview

Omnilingual ASR uses a modular data pipeline architecture separating storage (how data is read) from task (how data is processed). This enables flexible mixing of different storage backends with preprocessing pipelines.

MixtureParquetStorage

Parquet-based storage implementation with partition weighting and multilingual sampling.

Constructor

Path
required
Path to parquet dataset directory with language/corpus partitions.
MixtureParquetStorageConfig
required
Storage configuration including fragment streaming, loading, and weighting parameters.

Configuration: MixtureParquetStorageConfig

FragmentStreamingConfig
required
Controls how parquet fragments (row groups) are streamed:
  • seed: Random seed for shuffling
  • fragment_shuffle_window: Window size for fragment shuffling (-1 for global)
  • nb_epochs: Number of epochs (None for infinite)
FragmentLoadingConfig
required
Controls how fragments are loaded into memory:
  • columns: Schema mapping (use LangASRSchema)
  • nb_prefetch: Number of fragments to prefetch
  • num_parallel_fragments: Parallel loading threads
  • cache: Enable caching of decoded audio
str | None
Path to TSV file with corpus/language hour distribution for weighted sampling.
float | None
Beta parameter for corpus weighting: weight = (hours/total)^beta.
float | None
Beta parameter for language weighting within corpus.
SyncMode
default:"SyncMode.UNTIL_FIRST"
Synchronization mode for distributed training:
  • UNTIL_FIRST: Stop when first worker finishes (training)
  • UNTIL_LAST: Stop when last worker finishes (validation)
bool
default:"True"
Whether to synchronize batch sizes across workers.

Methods

create_raw_data_pipeline

Creates the raw data pipeline for reading parquet files.
str
required
Split name (e.g., “train”, “dev”, “test”). Can include corpus filter: “train_librispeech”.
Gangs
required
Gang configuration for distributed reading.
DataPipelineBuilder
Pipeline builder yielding dictionaries with audio bytes, text, language, and corpus.

Example

AsrTask

ASR preprocessing pipeline including audio filtering, tokenization, and batching.

Constructor

AsrTaskConfig
required
Task configuration for preprocessing pipeline.

Configuration: AsrTaskConfig

Audio Processing

int
default:"1"
Minimum audio sequence length (in samples). Shorter audio is filtered out.
int
default:"800000"
Maximum audio sequence length (~50s at 16kHz). Longer audio is filtered out.
bool
default:"False"
Whether to normalize audio to zero mean and unit variance.
bool
default:"False"
Whether to use filterbank features instead of raw waveforms.

SpecAugment

float | None
default:"None"
Probability of applying SpecAugment per sample.
int
default:"80"
Maximum frequency mask length for SpecAugment.
int
default:"80"
Maximum time mask length for SpecAugment.

Text Processing

int | None
default:"None"
Maximum text length in tokens. Longer sequences are filtered out.
bool
default:"False"
Whether to remove unknown tokens from text in-place.
int
default:"160"
Minimum audio samples per character. Samples with faster speech are filtered out.

Batching

BatchingStrategy
default:"LENGTH"
Batching strategy:
  • LENGTH: Dynamic batching by total elements (recommended)
  • STATIC: Fixed batch size
int
default:"8"
Batch size for STATIC batching strategy.
int
default:"3200000"
Maximum total elements per batch for LENGTH strategy.
int
default:"8"
Batch size must be multiple of this value (for hardware optimization).
bool
default:"False"
Whether to drop last incomplete batch.

Pipeline Settings

int
default:"0"
Sliding window size for shuffling examples before batching.
int
default:"1000"
Sliding window size for shuffling batches.
int
default:"4"
Number of batches to prefetch in background.
int
default:"10"
Number of parallel calls for data pipeline operations.

Methods

apply_processing_pipeline

Applies the complete ASR preprocessing pipeline.
DataPipelineBuilder
required
Input pipeline builder (typically from storage layer).
Gangs
required
Gang configuration.
Tokenizer
required
Tokenizer for text encoding.
torch.dtype
required
Data type for audio tensors.
DataPipelineBuilder
Pipeline builder yielding Seq2SeqBatch objects.

Pipeline Stages

The ASR task pipeline processes data in the following order:
  1. Audio Filtering: Filter by length (min_audio_len, max_audio_len)
  2. Example Shuffling: Shuffle before batching (example_shuffle_window)
  3. Text Tokenization: Encode text with tokenizer
  4. Text Filtering: Filter empty text, unknown sequences, long text
  5. Batching: Bucket by audio length or static batch size
  6. Batch Shuffling: Shuffle batches (batch_shuffle_window)
  7. Audio Decoding: Decode audio bytes to waveforms
  8. Audio Processing: Normalize, convert to mono, optionally apply SpecAugment
  9. Feature Extraction: Extract fbank features (if use_fbank=True)
  10. Collation: Collate into padded batches
  11. Prefetching: Prefetch batches in background
  12. Seq2SeqBatch Conversion: Convert to final batch format

Example

Audio Preprocessing

Audio Decoding

Audio bytes are decoded using fairseq2’s AudioDecoder:

Normalization

Mono Conversion

SpecAugment

Applied with probability spec_aug_p:
  1. Convert waveform to spectrogram
  2. Apply frequency masking (random mask of length up to spec_aug_freq_mask_param)
  3. Apply time masking (random mask of length up to spec_aug_time_mask_param)
  4. Convert back to waveform

Filterbank Features

If use_fbank=True:

Schema Definitions

LangASRSchema

Column mapping for parquet datasets:

Complete Example: Training Pipeline

Source References

  • MixtureParquetStorage: src/omnilingual_asr/datasets/storage/mixture_parquet_storage.py:133
  • AsrTask: src/omnilingual_asr/datasets/tasks/asr_task.py:140
  • Audio utilities: src/omnilingual_asr/datasets/utils/audio.py