nemo_automodel.components.models.mimo_v2_flash
nemo_automodel.components.models.mimo_v2_flash
Submodules
nemo_automodel.components.models.mimo_v2_flash.confignemo_automodel.components.models.mimo_v2_flash.cpnemo_automodel.components.models.mimo_v2_flash.modelnemo_automodel.components.models.mimo_v2_flash.parallelizationnemo_automodel.components.models.mimo_v2_flash.state_dict_adapternemo_automodel.components.models.mimo_v2_flash.vision
Package Contents
Classes
API
Bases: MiMoV2FlashConfig
Configuration for MiMo-V2.5 and MiMo-V2.6 checkpoints.
These checkpoints retain the MiMo-V2-Flash text backbone while using the
mimo_v2 model type, fused QKV checkpoint layout, and optional
multimodal encoder configuration.
Bases: PretrainedConfig
Configuration for XiaomiMiMo/MiMo-V2-Flash.
The Hugging Face remote config class currently leaves model_type empty.
Automodel registers this local config with the hub’s JSON model_type so
configs can resolve without executing remote code.
Bases: HFCheckpointingMixin, Module, MoEFSDPSyncMixin
Causal LM wrapper for MiMo-V2-Flash with Automodel checkpoint adapters.
Encode global media and splice only this TE THD shard’s feature rows.
Map local TE THD placeholders to rows in globally ordered media features.
Retrieve PP media using global masks so every CP rank runs the same vision work.
Keep both rotary embeddings per stage and the vision tower on stage zero.
Run text or VLM forward with TE-local packed media placement.
Describe PP tensors using the already TE-sharded local token length.
Install MiMo’s model-local adapter around framework TE THD sharding.
Bases: Module
Backbone model for Xiaomi MiMo-V2-Flash.
Run the text backbone in BSHD or genuine TE THD layout.
THD batches must already have passed through the framework TE sharder. Their cumulative lengths delimit packed documents and are forwarded to every attention layer, including non-first pipeline stages.
Bases: MoESplitExpertsStateDictMixin, StateDictAdapter
Convert MiMo-V2-Flash 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 materializing every expert on every rank.
Whether checkpoint tensors use MiMo-V2.6 fused QKV and MXFP4 experts.
TP degree interleaving fused QKV rows in the source checkpoint, resolved once.
Rename matching state-dict leaves in place without touching prefixes.
Replace checkpoint fused QKV tensors with native split projections.
Parameters:
Checkpoint tensor mapping. Fused QKV weights have shape [checkpoint_tp_size * local_qkv_rows, hidden], and optional scale tensors have shape [checkpoint_tp_size * local_scale_rows, hidden_blocks].
Returns: dict[str, Any]
The mutated mapping with split query, key, and value weights.
Copy a full checkpoint-layout conversion into local model storage.
Parameters:
Native Tensor or DTensor with the global projection shape.
Rank-local model storage for native_tensor.
Full deinterleaved projection in checkpoint dtype conversion output.
Expand packed expert weights into the native floating-point layout.
Parameters:
Checkpoint tensor mapping. MXFP4 expert weights have
shape [output, input / 2], and their weight_scale tensors
have shape [output, input / 32].
Returns: dict[str, Any]
The mutated mapping with floating-point expert matrices.
Return the rank-local storage view for a Tensor or DTensor.
Create V2.6 fused-QKV checkpoint buffers for three native weights.
Parameters:
Projection prefix ending in self_attn.
Decoder layer index selecting full or sliding shapes.
Native query weight of shape [query_rows, hidden].
Native key weight of shape [key_rows, hidden].
Native value weight of shape [value_rows, hidden].
Returns: dict[str, torch.Tensor]
Fused FP8 weight and FP32 inverse-scale destinations using the exact
Create packed MXFP4 destinations for one logical expert matrix.
Parameters:
Checkpoint expert weight key.
Logical expert view of shape [output, input].
Returns: list[tuple[str, torch.Tensor]]
Packed E2M1 weight [output, input / 2] and E8M0 scales
Map one native MiMo tensor name back to its Hugging Face leaf name.
Convert native tensors to MiMo checkpoint keys and load destinations.
Bases: MiMoV2FlashForCausalLM
MiMo-V2.5/V2.6 wrapper using the mimo_v2 checkpoint config.
Resolve a MiMo-V2 config while checkpoint loading remains framework-owned.