nemo_automodel.components.models.deepseek_v41.pipeline
nemo_automodel.components.models.deepseek_v41.pipeline
Model-owned pipeline partition dependencies and CSA2 tensor wire layouts.
Module Contents
Classes
API
Backbone values before or after the stage-local final norm.
Immutable CSA2 values described by DeepseekV41AttentionState.
[batch, local_sequence, streams, hidden] on an intermediate stage, or normalized [batch, local_sequence, hidden] on the last stage.
FP32 coefficients [batch, local_sequence, streams]. They remain differentiable across a pipeline boundary.
Optional pre-block states, each [batch, local_sequence, streams, hidden], for parity diagnostics.
Preserve model dependencies across the configured contiguous stages.
Expose immutable live CSA2 tensors to native PP autograd.
Parameters:
Values with layouts in DeepseekV41AttentionState. Compressed KV keeps its gradient history; frozen index keys use a byte view so PP does not allocate or expect meaningless floating gradients.
Index of the next language layer.
Returns: torch.Tensor
Empty tuple at a dead-state boundary. Otherwise: differentiable KV
Validate a nonempty contiguous stage and return its half-open layer range.
Describe live state tensors using the layouts of _pack_pipeline_state.
Return the live KV ratio at a supplied cut, or zero if its state is dead.
This determines the wire contract, not the partition. Window-only layers preserve a lineage; a new Full layer replaces it before any consumer.
Restore stage-local immutable CSA2 state without detaching shared KV.
Parameters:
Wire tensors documented by _pack_pipeline_state.
Index of this stage’s first language layer.
Tensor [batch, local_sequence, streams, hidden] whose device and compute dtype also define the incoming KV contract.
Whether token metadata contains packed document IDs.
Returns: DeepseekV41AttentionState
CSA2 state with layouts in DeepseekV41AttentionState. Its tensors
Retain the supplied layer split and attach stage-owned dependencies.
Manual module_fqns_per_model_part uses the framework’s existing complete-module-list contract. This hook augments framework-generated splits; it does not choose or move layer boundaries.
Describe local CP-shard tensors sent between pipeline stages.
Returns: tuple[torch.Tensor, ...]
Input/output meta tensors. The intermediate payload consists of