> This page is for version Nightly (default).
> For other versions, use one of these documentation indexes:
> - Nightly (default): https://docs.nvidia.com/nemo/automodel/nightly/llms.txt
> - Latest: https://docs.nvidia.com/nemo/automodel/latest/llms.txt
> - 0.5.0 · 26.06: https://docs.nvidia.com/nemo/automodel/v0.5/llms.txt
> - 0.4.0 · 26.04: https://docs.nvidia.com/nemo/automodel/v0.4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/automodel/_mcp/server.

# nemo_automodel.components.models.muse_spark.state_dict_adapter

Checkpoint conversion for the released Muse Spark Open dump.

## Module Contents

### Classes

| Name                                                                                                                     | Description                                                              |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| [`MuseSparkStateDictAdapter`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-MuseSparkStateDictAdapter) | Convert raw grouped Muse experts and multimodal namespaces to AutoModel. |

### Functions

| Name                                                                                                       | Description                                                       |
| ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [`_native_to_raw_key`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_native_to_raw_key) | Map one native tensor key to the released checkpoint hierarchy.   |
| [`_raw_to_native_key`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_raw_to_native_key) | Map one serialized checkpoint key to the native module hierarchy. |

### Data

[`_AUDIO_PREFIX`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_AUDIO_PREFIX)

[`_LEGACY_VISION_PREFIX`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_LEGACY_VISION_PREFIX)

[`_NATIVE_EXPERT_RE`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_NATIVE_EXPERT_RE)

[`_RAW_EXPERT_RE`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_RAW_EXPERT_RE)

[`_RAW_LAYER_RE`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_RAW_LAYER_RE)

[`_REDUNDANT_VISION_PREFIX`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_REDUNDANT_VISION_PREFIX)

[`_VISION_PROJECTION`](#nemo_automodel-components-models-muse_spark-state_dict_adapter-_VISION_PROJECTION)

### API

```python
class nemo_automodel.components.models.muse_spark.state_dict_adapter.MuseSparkStateDictAdapter(
    config: nemo_automodel.components.models.muse_spark.config.MuseSpark1xOmniConfig,
    moe_config: nemo_automodel.components.moe.config.MoEConfig,
    backend: nemo_automodel.components.models.common.BackendConfig,
    dtype: torch.dtype = torch.bfloat16
)
```

**Bases:** [StateDictAdapter](/nemo-automodel/nemo_automodel/components/checkpoint/state_dict_adapter#nemo_automodel-components-checkpoint-state_dict_adapter-StateDictAdapter)

Convert raw grouped Muse experts and multimodal namespaces to AutoModel.

The checkpoint stores expert matrices as `[E,out,in]` while the reusable
grouped-GEMM implementation consumes `[E,in,out]`. Under expert
parallelism, conversion first selects this rank's contiguous expert range,
transposes only that slice, and wraps the local result as an EP DTensor.

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter.MuseSparkStateDictAdapter.convert_single_tensor_to_hf(
    fqn: str,
    tensor: torch.Tensor,
    kwargs: str | bool | None = {}
) -> list[tuple[str, torch.Tensor]]
```

Convert a native tensor, preserving grouped expert tensors as views.

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter.MuseSparkStateDictAdapter.from_hf(
    hf_state_dict: dict[str, torch.Tensor],
    device_mesh: torch.distributed.device_mesh.DeviceMesh | None = None,
    kwargs: str | bool | None = {}
) -> dict[str, torch.Tensor]
```

Convert released keys and slice grouped experts for the EP owner rank.

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter.MuseSparkStateDictAdapter.to_hf(
    state_dict: dict[str, torch.Tensor],
    exclude_key_regex: str | None = None,
    kwargs: str | bool | None = {}
) -> dict[str, torch.Tensor]
```

Convert native tensors to released Muse Spark Open checkpoint keys.

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._native_to_raw_key(
    key: str
) -> str | None
```

Map one native tensor key to the released checkpoint hierarchy.

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._raw_to_native_key(
    key: str
) -> str | None
```

Map one serialized checkpoint key to the native module hierarchy.

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._AUDIO_PREFIX = 'modalities.soft_audio_perception.interaction_encoder.'
```

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._LEGACY_VISION_PREFIX = 'modalities.vision_perception.encoder.vision_module.'
```

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._NATIVE_EXPERT_RE = re.compile('model\\.layers\\.(\\d+)\\.feed_forward\\.experts\\.(gate_and_up_proj...
```

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._RAW_EXPERT_RE = re.compile('model\\.layers\\.(\\d+)\\.feed_forward\\.experts\\.(w13_weight|w2_we...
```

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._RAW_LAYER_RE = re.compile('model\\.layers\\.(\\d+)\\.')
```

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._REDUNDANT_VISION_PREFIX = 'modalities.vision_perception.encoder.vision_model.'
```

```python
nemo_automodel.components.models.muse_spark.state_dict_adapter._VISION_PROJECTION = 'modalities.vision_perception.encoder.vision_projection.weight'
```