nemo_automodel.components.models.step5.state_dict_adapter
nemo_automodel.components.models.step5.state_dict_adapter
Step-5 FP8 loading, interleaved QKV mapping and native expert conversion.
Module Contents
Classes
Data
API
Bases: Step3p5StateDictAdapter
Preserve Step-family expert conversion and add Step-5 attention mappings.
Loading needs bounded per-projection conversion storage, so the adapter does not advertise the DCP direct-destination fast path.
Load mixed FP8/BF16 expert projections into final BF16 storage.
Parameters:
Final native storage: fused gate/up tensors [experts, hidden, 2 * intermediate], down tensors [experts, intermediate, hidden], and other native model tensors. DTensors shard experts over ep and input dimensions over ep_shard.
Optional expert mesh used for native/HF conversion.
Export native attention and expert tensors to checkpoint names.
Parameters:
Native tensor name.
Tensor with the native layout documented by from_hf.
Optional exported-name exclusion regex.
Whether quantized export is requested (unsupported).
Checkpointer options forwarded to the base adapter.
Returns: list[tuple[str, torch.Tensor]]
Named source tensors with [out, in] projections or [experts, out, in] experts.
Load source tensors into trainable, interleaved native storage.
Parameters:
Mapping to source tensors. Experts have layout [experts, out, in]; Q/K/V have layout [heads * head_dim, hidden].
Optional expert mesh handled by the Step-family adapter.
Checkpointer options forwarded to the base adapter.
Returns: dict[str, torch.Tensor]
Mapping to native tensors. QKV has layout
Load in bounded parts unless this rank holds only part of the decoder.
Every rank issues one load collective per part. Pipeline stages own different decoder layers, so their part counts differ; such ranks use the ordinary checkpoint load instead.
Parameters:
Final native storage; see _iter_checkpoint_load_parts.
Optional expert mesh used for native/HF conversion.
Returns: Iterator[CheckpointLoadPart] | None
Checkpoint load parts, or None on a distributed rank whose state