vllm.model_executor.models.nemotron3_5_transcribe_audio
¶
Audio tower of Nemotron-3.5-Transcribe.
A native port of the inference path of NeMo's AudioPerceptionModule with a
ParallelExpertEncoder:
waveform -> log-mel -> Parallel Expert Encoder -> Linear -> decoder width
The Parallel Expert Encoder runs an ASR TransformerEncoder and a streaming
Sortformer speaker encoder over the same mel features. Both run in windows of
window_frames encoder frames with left and right context, and the speaker
encoder carries a speaker cache and a FIFO between windows. Thresholded speaker
activity is added to the normalized ASR states through a fixed sinusoidal
kernel. Module names follow NeMo so the checkpoint loads by prefix.
Classes:
-
AudioPreprocessor–Holds the featurizer under NeMo's
preprocessor.featurizername. -
FeatureStacking–Stack
factorconsecutive frames and project them to the model width. -
MelSpectrogram–Log-mel features as NeMo
FilterbankFeaturescomputes them at inference. -
MultiHeadAttention– -
Nemotron3_5TranscribeAudioTower–Waveform to decoder-width embeddings: mel, Parallel Expert Encoder, Linear.
-
PackedFrames–The valid frames of a padded
(B, T)batch, packed row after row. -
ParallelExpertEncoder–NeMo
ParallelExpertEncoderonline inference with a transformer ASR encoder. -
RotaryEmbedding–NeMo
RotaryPositionalEncoding: NeoX rotation of the firstrot_dimdims. -
SortformerModules–Speaker head and speaker cache of NeMo
SortformerModulesat inference. -
SortformerSpeakerEncoder–Streaming inference of the high-resolution Sortformer in NeMo's PEE.
-
SpeakerCacheState–Synchronous streaming state of the Sortformer speaker encoder.
-
TransformerEncoder–NeMo
TransformerEncoderwith RoPE and full attention, at inference.
Functions:
-
align_frames–Pad with the last frame, or truncate,
(B, T, S)totarget_lenframes. -
downsample_preds–Average
(B, T, S)probabilities over windows offactorframes. -
normalize_per_feature–NeMo
normalize_batch(x, seq_len, "per_feature")on(B, C, T)features.
FeatureStacking
¶
MelSpectrogram
¶
Bases: Module
Log-mel features as NeMo FilterbankFeatures computes them at inference.
Dither is off and no normalization is applied; frames past each row's
length are set to pad_value. The filterbank and window come from the
checkpoint and are held in the model dtype, as in the reference, and are
upcast to float32 for the computation.
MultiHeadAttention
¶
Nemotron3_5TranscribeAudioTower
¶
Bases: Module
Waveform to decoder-width embeddings: mel, Parallel Expert Encoder, Linear.
Methods:
-
encode–Encode each clip into its embeddings, returned in input order.
-
forward–Encode padded
(B, N)float32 audio into one embedding tensor per row. -
load_weights–Load NeMo
perception.*tensors, named without theperception..
encode(signals, num_samples_cpu)
¶
Encode each clip into its embeddings, returned in input order.
Every row of a batch runs every window of the batch's longest clip, so a clip is batched only with clips that span as many windows.
forward(audio, num_samples, num_samples_cpu)
¶
Encode padded (B, N) float32 audio into one embedding tensor per row.
num_samples_cpu holds the lengths on the host, so the window bounds
and the output lengths need no device-to-host copy.
load_weights(weights)
¶
Load NeMo perception.* tensors, named without the perception..
PackedFrames
dataclass
¶
The valid frames of a padded (B, T) batch, packed row after row.
rows indexes the flattened batch and positions holds each frame's
position in its row. cu_seqlens, max_seqlen and sequence_lengths
are in the format of the attention backend.
ParallelExpertEncoder
¶
RotaryEmbedding
¶
NeMo RotaryPositionalEncoding: NeoX rotation of the first rot_dim dims.
Angles are computed in float32 on the CPU and stored in the activation dtype before use, as the reference does, so rotations match bit for bit.
SortformerModules
¶
Bases: Module
Speaker head and speaker cache of NeMo SortformerModules at inference.
Methods:
-
speaker_probs–Upsampled speaker probabilities,
(B, T * upsample_factor, n_spk). -
update–NeMo
SortformerModules.streaming_update(synchronous).
SortformerSpeakerEncoder
¶
Bases: Module
Streaming inference of the high-resolution Sortformer in NeMo's PEE.
Mirrors SortformerEncLabelModel.forward_streaming_step for synchronous
streaming without speaker permutation. Each step returns speaker
probabilities on the encoder frame grid for the window's core frames.
Methods:
-
step–Process one window of
(B, C, T)mel features.
step(features, lengths, state, left_offset, right_offset, lengths_cpu=None)
¶
Process one window of (B, C, T) mel features.
Returns the new state and the core frames' speaker probabilities on the encoder grid.
SpeakerCacheState
dataclass
¶
Synchronous streaming state of the Sortformer speaker encoder.
TransformerEncoder
¶
Bases: Module
NeMo TransformerEncoder with RoPE and full attention, at inference.
forward takes (B, C, T) mel features, or (B, T, d_model)
pre-encoded embeddings with bypass_pre_encode=True, and returns
(B, d_model, T') states with their lengths. Only each row's valid frames
run through the layers, packed for variable-length attention; the padded
positions of the output are zero. lengths_cpu, the lengths on the host,
lets the packing skip a device-to-host copy.
Methods:
-
pack–Index each row's valid frames; rows without any are left out.
pack(lengths_cpu, num_frames, device)
¶
Index each row's valid frames; rows without any are left out.
_TowerLinear
¶
Bases: ReplicatedLinear
A replicated linear layer over the last dimension of any input shape.
vLLM's quantized kernels take (tokens, features); the tower's activations
are (batch, frames, features).
_linear(in_features, out_features, *, bias, quant_config, prefix)
¶
A linear layer the checkpoint's quantization config applies to by name.
align_frames(preds, target_len)
¶
Pad with the last frame, or truncate, (B, T, S) to target_len frames.
downsample_preds(preds, factor)
¶
Average (B, T, S) probabilities over windows of factor frames.
normalize_per_feature(x, seq_len)
¶
NeMo normalize_batch(x, seq_len, "per_feature") on (B, C, T) features.