nemo_automodel.components.models.ergo.model
nemo_automodel.components.models.ergo.model
Native Ergo causal model with an FP32 residual stream.
Module Contents
Classes
Data
API
Bases: HFCheckpointingMixin, Module, MoEFSDPSyncMixin
Train the floating Ergo target through the standard AutoModel factory.
SDPA owns document-preserving CP; TE retains its packed alignment.
Request CP1 raw-batch conversion for FA4; TE owns its CP partitioning.
TE owns packed preparation at CP1 as well as CP>1, including PP.
Produce logits; unshifted HF labels are optional outside the recipe.
Standard training recipes own the shift and loss. They do not pass HF labels here. The final normalized hidden states are also returned for the shared fused/chunked loss path.
Parameters:
Global token IDs [batch, sequence] on stage zero or CP-local FP32 residuals [batch, local_sequence, hidden] later.
Integer RoPE positions matching local token axes.
Local document IDs [batch, local_sequence], or a CP1 boolean allow-mask [batch, 1, sequence, sequence].
Boolean padding indicators matching local token axes.
Unshifted HF labels [batch, sequence], CP1 only. CP recipes shift labels before partitioning and compute loss externally.
Number of trailing tokens or integer token indices [selected_sequence] to project.
Accepted for Hugging Face compatibility.
Backend-specific packed attention metadata.
Returns: CausalLMOutputWithPast | torch.Tensor
Model output containing local logits [batch, selected_sequence,
Construct from the config resolved by AutoModel’s public loader.
Return the untied FP32 token embedding.
Return the untied output projection.
Describe token inputs, FP32 residual transport, and final logits.
Parameters:
Whether this stage owns the token embedding.
Number of sequences in one pipeline microbatch.
Global tokens per sequence before CP padding.
Framework compute dtype for a final projection without a logits override.
Returns: tuple[torch.Tensor, ...]
Input/output meta tensors: IDs [B,S], CP-local residuals [B,L,H],
Materialize and initialize every parameter and routing buffer.
Storage and compute precision are the ones the constructor established from the configuration
(dtype and compute_dtype); this method changes neither.
Parameters:
Device for parameters and buffers; None keeps the parameters’ device.
Unused. The checkpoint loader passes the dtype of the model’s first parameter, the token embedding, which is FP32 at every storage precision and so says nothing about the model.
Select model-owned SDPA sharding or shared TE partitioning.
Parameters:
Global IDs and auxiliaries [batch, sequence]. SDPA accepts document-ID attention masks; TE uses THD for packed documents.
Positive number of pipeline microbatches.
Returns: dict[str, Any]
A weight-free sharder descriptor and optional padding mask. BSHD
Keep source correction biases fixed during fine-tuning.
Bases: Module
Embedding, globally numbered decoder blocks and final normalization.
Return FP32 states, preserving CP-local token ownership.
Parameters:
Integer IDs [batch, global_sequence] on the first stage, or FP32 residuals [batch, local_sequence, hidden] on later stages. Packed TE IDs remain global [1, tokens] with local indices in metadata; later stages receive [1, local_tokens, hidden].
Integer RoPE positions matching local token axes.
Local document IDs [batch, local_sequence], or a boolean allow-mask [batch, 1, sequence, sequence] without CP.
Boolean padding indicators matching local token axes.
Backend-specific packed attention metadata. The ergo_te_local_indices map selects stage-zero IDs exactly once.
Returns: torch.Tensor
FP32 states [batch, local_sequence, hidden] or [tokens, hidden].