mstar.model.nemotron_duplex.components.conformer#

Fast-Conformer STT perception stack (stt_model.perception.*).

NeMo Fast-Conformer: mel preprocessor -> dw-striding conv subsampling -> 24 Conformer layers (Macaron FF, rel-pos MHA, conv module) -> projection into the nano LLM hidden space (1024 -> 4480).

Ported to exact checkpoint parity and numerically verified against the NeMo nemotron-labs-voicechat reference. Every architecture dim comes from ConformerSTTConfig (populated from the checkpoint’s config.json -> model.stt.model.perception); nothing is hardcoded here. Config highlights: att_context_size=[70, 0] chunked-limited (left window 70, causal), causal dw_striding subsampling factor 8, conv_context_size='causal' depthwise conv, conv_norm_type='layer_norm' (so the conv.batch_norm tensor is a LayerNorm over channels – which is why the checkpoint has only weight+bias and no running stats), Macaron 0.5 FF scaling, xscaling=False, use_bias=False on all FF/attn/conv linears, Swish (SiLU) activations, mel power spectrum with preemphasis 0.97.

Classes

ConformerEncoder(config)

ConformerLayer(config)

ConvSubsampling(config)

Causal dw-striding subsampling (factor 8): CausalConv2d, ReLU, (depthwise CausalConv2d, pointwise, ReLU) x2 -> Linear(4352 -> d_model).

Perception([config])

Full perception stack: preprocessor + conformer encoder + LLM projection.

Preprocessor(config)

class mstar.model.nemotron_duplex.components.conformer.ConformerEncoder(config)[source]#

Bases: Module

Parameters:

config (ConformerSTTConfig)

forward(audio_signal, length)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:
class mstar.model.nemotron_duplex.components.conformer.ConformerLayer(config)[source]#

Bases: Module

Parameters:

config (ConformerSTTConfig)

FC_FACTOR = 0.5#
forward(x, att_mask, pos_emb, pad_mask)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class mstar.model.nemotron_duplex.components.conformer.ConvSubsampling(config)[source]#

Bases: Module

Causal dw-striding subsampling (factor 8): CausalConv2d, ReLU, (depthwise CausalConv2d, pointwise, ReLU) x2 -> Linear(4352 -> d_model).

Parameters:

config (ConformerSTTConfig)

calc_length(lengths)[source]#
Parameters:

lengths (Tensor)

Return type:

Tensor

forward(x, lengths)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:
class mstar.model.nemotron_duplex.components.conformer.Perception(config=None)[source]#

Bases: Module

Full perception stack: preprocessor + conformer encoder + LLM projection.

Parameters:

config (ConformerSTTConfig | None)

forward(input_signal=None, input_signal_lens=None, processed_signal=None, processed_signal_lens=None)[source]#

(B, samples) waveform -> (B, T’, 4480) LLM-space embeddings, lengths.

Pass processed_signal (B, n_mels, T) to bypass the mel featurizer.

Parameters:
  • input_signal (Tensor | None)

  • input_signal_lens (Tensor | None)

  • processed_signal (Tensor | None)

  • processed_signal_lens (Tensor | None)

load_weights(weights)[source]#
static remap(name)[source]#
Parameters:

name (str)

Return type:

str | None

class mstar.model.nemotron_duplex.components.conformer.Preprocessor(config)[source]#

Bases: Module

Parameters:

config (ConformerSTTConfig)

forward(x, seq_len)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.