nemo_automodel.components.models.muse_spark.hf_state_dict_adapter
nemo_automodel.components.models.muse_spark.hf_state_dict_adapter
Checkpoint adapter for the nested Hugging Face Muse Spark Open release.
Module Contents
Classes
Functions
Data
API
Bases: MuseSparkStateDictAdapter
Load the HF release through rank-local, predominantly direct DCP storage.
Expert transposes are views into final native storage, including without EP. Only Q/K row permutations allocate, bounded by the Q/K projections owned by this stage and at most one gathered projection during conversion. No full expert tensor is rebuilt after a direct load.
Enable direct destinations only for the supported dense expert layouts.
Return the head width for text/vision Q/K weights and vision Q/K biases.
Convert one native tensor into an HF checkpoint tensor.
Parameters:
Native state name.
Expert [experts, in, out], router [experts, hidden], projection [out, in], bias/norm [out], or embedding [vocab, hidden]. DTensors retain their global shapes and parameter placements.
Checkpointer’s exclude_key_regex and for_checkpoint_load.
Returns: list[tuple[str, torch.Tensor]]
Zero or one (HF name, tensor) pairs. Expert [experts, out, in]
Convert HF text, vision and audio tensors to the native checkpoint.
Parameters:
HF names mapped to experts [experts, out, in], routers [experts, hidden], projections [out, in], vectors [out], and embeddings [vocab, hidden]. DCP destinations may be strided model-storage views or DTensors with global shapes.
Optional EP mesh used to slice unsharded expert input. Already-sharded DTensor experts preserve their existing mesh.
Unused shared checkpoint adapter arguments.
Returns: dict[str, torch.Tensor]
Native names and tensor layouts. Expert transposes and unchanged
Map one HF release name to the native model hierarchy.
Map one native text, vision, or audio state name to the HF release.
Convert adjacent-pair and split-half RoPE projection rows.
Parameters:
Projection [heads * head_dim, hidden] or bias [heads * head_dim]. A DTensor retains its global shape and arbitrary Shard/Replicate placements. Rank-local row fragments need not span complete heads.
Width of a complete attention head.
Convert adjacent pairs to split halves when true; invert otherwise.
Returns: torch.Tensor
Independent contiguous tensor with the input shape, dtype and device.