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
|
|
|
|
|
Causal dw-striding subsampling (factor 8): CausalConv2d, ReLU, (depthwise CausalConv2d, pointwise, ReLU) x2 -> Linear(4352 -> d_model). |
|
Full perception stack: preprocessor + conformer encoder + LLM projection. |
|
- 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
Moduleinstance 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.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
Moduleinstance 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:
ModuleCausal dw-striding subsampling (factor 8): CausalConv2d, ReLU, (depthwise CausalConv2d, pointwise, ReLU) x2 -> Linear(4352 -> d_model).
- Parameters:
config (ConformerSTTConfig)
- 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
Moduleinstance 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.Perception(config=None)[source]#
Bases:
ModuleFull perception stack: preprocessor + conformer encoder + LLM projection.
- Parameters:
config (ConformerSTTConfig | 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.