nemo_curator.stages.audio.inference.asr.stage
nemo_curator.stages.audio.inference.asr.stage
Generic audio ASR Curator stage with a pluggable adapter.
Curator-side glue validates I/O, resolves per-task language, and writes
predictions. The concrete adapter is resolved at runtime from
adapter_target via hydra.utils.get_class.
Module Contents
Classes
Functions
Data
API
Bases: AdapterInferenceStage[ASRAdapter]
Audio speech-recognition stage with a pluggable adapter.
The stage writes pred_text_key and optional control columns _skipme
and additional_notes. When extras_key is configured, it also writes
non-empty adapter metadata as one nested dictionary under that key.
Audio longer than max_inference_duration_s is always split into
model-safe segments and stitched back to one result per parent row. Every
segment prepared by one backend-provided process_batch call is packed
into adapter calls bounded by max_audio_sec_per_actor. Enabling
local_bucketing first orders those segments by duration to reduce GPU
padding; disabling it preserves their input order.
Construct the configured ASR adapter.
Treat representation-level equality as within the configured budget.
Open one resampled file inside the ASR worker.
torchaudio.load returns channel-first audio. Resampled pipeline
inputs are normally mono, so squeezing removes that singleton channel;
multichannel inputs remain channel-first for _prepare_waveform to
downmix.
Normalize an optional adapter-specific supported-language allowlist.
Find the exact lexicographic optimum over sorted contiguous spans.
Greedily preserve input order while enforcing padded capacity.
Optimally pack one finite segment list under the padded-audio budget.
The proxy cost of an adapter call is its longest audio duration times its item count. This models the padded tensor work more closely than a sum of unpadded durations. With local bucketing enabled, dynamic programming over the stable duration order first minimizes adapter-call count and then total padded seconds. The budget is enforced in both modes.
Return contiguous mono float32 samples at target_sample_rate.
Return the configured machine-readable reason for a skipped result.
Run capacity-bounded adapter calls and restore segment order.
Join ordered chunk outputs into one parent-row result.
Write the configured language output or routing notes.
Write adapter results to tasks.
Return an explicit backend worker count when configured.
Run one ASR batch.
Transcribe one stage batch via the adapter.