nemo_automodel.components.models.mimo_v25.state_dict_adapter
nemo_automodel.components.models.mimo_v25.state_dict_adapter
Module Contents
Classes
Functions
Data
API
Bases: MoESplitExpertsStateDictMixin, StateDictAdapter
Convert MiMo-V2.5-Pro HF checkpoints to Automodel’s grouped MoE layout.
HF stores routed experts as split per-expert projections:
mlp.experts.{E}.{gate,up,down}_proj.weight. Automodel groups those
into gate_and_up_projs and down_projs so EP can shard experts
without materialising every expert on every rank.
MiMo-V2.5-Pro stores fused QKV projections as TP-interleaved shards. The
adapter dequantizes each checkpoint shard independently, then restores the
canonical [Q, K, V] row layout expected by the model.
Dequantize and canonicalize a TP-interleaved fused QKV projection.
Parameters:
Tensor of shape [interleaved_qkv, hidden]. Axis 0 stores checkpoint TP shards, each laid out as [Q_shard, K_shard, V_shard]. A DTensor may shard either axis; its placements and global shape are preserved in the returned tensor.
Tensor of shape [tp * scale_rows_per_shard, scale_columns]. Each checkpoint TP shard owns an independent 128x128 FP8 scale grid.
Fully qualified weight name containing the decoder layer index.
Returns: torch.Tensor
Tensor of shape [q_rows + k_rows + v_rows, hidden] in canonical
Convert one parameter into HF weights and FP8 scale tensors.
Parameters:
Automodel parameter name.
Parameter tensor with the native layout documented by
to_hf; a DTensor retains its global shape and placements.
Adapter options, including for_checkpoint_load when
allocating destinations for the pretrained checkpoint.
Returns: list[tuple[str, Any]]
Named tensors in HF layout. For checkpoint loading, fused QKV
Export HF weights or allocate destinations for an FP8 base checkpoint.
Parameters:
Native tensors with their original shapes and dtypes. Grouped gate/up weights have shape [experts, hidden, 2 * intermediate] and down weights have shape [experts, intermediate, hidden]. Fused QKV weights have shape [q_rows + k_rows + v_rows, hidden] in canonical [Q, K, V] row order.
Optional pattern for omitted parameter names.
Allocate FP8 tensors when loading the base checkpoint. Quantized export is unsupported; ordinary export retains precision.
Adapter options, including for_checkpoint_load.
Returns: dict[str, Any]
HF tensors preserving input dtypes and canonical QKV order. Experts