nemo_curator.models.asr.base
nemo_curator.models.asr.base
Stage-adapter contract for audio speech-recognition.
ASRStage owns Curator-side glue (task.data reads, batching, ISO
language mapping, _skipme), while ASRAdapter owns the model-side call
(weight download, model loading, generation, and packing into ASRResult).
The split lets the stage swap models via a single YAML adapter_target: line.
Module Contents
Classes
API
Structural protocol every ASR adapter must implement.
ASRStage constructs adapters with model_id and the explicitly
configured adapter_kwargs. Model-provider options therefore stay with
the adapter that implements them instead of becoming shared stage fields.
Per-batch contract: transcribe_batch receives a list of per-task dicts
(unpacked from task.data) and returns one ASRResult per input, in
order. Expected per-item keys (stage-populated):
waveform: contiguous, mono, 1-D float32 NumPy samples normalized byASRStagefrom a file or a reader-provided in-memory waveform.sample_rate(int): the stage’s configured target sample rate.audio_seconds(float): duration of this model-input chunk.language(str | None): human-readable name (e.g."English").language_code(str | None): original language code from the configured stage input column.task_id(str | None): carried through for diagnostics.
Identifier of the underlying model checkpoint.
Download weights to local cache without allocating a GPU.
The stage calls this once per node on a lightweight adapter instance so provider-specific download options remain encapsulated by that adapter.
Load the model into the worker process using the stage-owned GPU count.
ASRStage derives num_gpus from its Curator resource request so
adapters do not expose a second, independently configurable GPU count.
Run inference on a batch of per-task dicts.
Returns one ASRResult per input, in order; skipped items must
still appear with skipped=True to preserve task ordering.
Release GPU memory and worker-local state.
Canonical per-utterance ASR adapter output.
Identical across every adapter so the stage’s schema-mutation path stays constant when the adapter is swapped.
Adapter-specific, manifest-serializable diagnostics. When the
stage’s extras_key is enabled, it writes a shallow copy of this
dictionary under that one nested output field without interpreting
individual keys.
Optional machine-readable reason written to _skipme
when skipped is true. Defaults to "empty_audio" in the stage.
True when the item could not be processed. The stage writes
skip_reason to _skipme and falls back to "empty_audio"
when no reason is supplied.
Transcription text. Empty if skipped.
Optional normalized language code used by the stage to annotate items excluded by its language allowlist.