> 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.ernie4_5.state_dict_adapter

## Module Contents

### Classes

| Name                                                                                                                         | Description                                                              |
| ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [`Ernie4_5StateDictAdapter`](#nemo_automodel-components-models-ernie4_5-state_dict_adapter-Ernie4_5StateDictAdapter)         | Passthrough adapter for dense ERNIE 4.5 checkpoints.                     |
| [`Ernie4_5_MoeStateDictAdapter`](#nemo_automodel-components-models-ernie4_5-state_dict_adapter-Ernie4_5_MoeStateDictAdapter) | Convert ERNIE 4.5 MoE HF checkpoints to AutoModel grouped-expert format. |

### Data

[`logger`](#nemo_automodel-components-models-ernie4_5-state_dict_adapter-logger)

### API

```python
class nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5StateDictAdapter(
    config: typing.Any
)
```

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

Passthrough adapter for dense ERNIE 4.5 checkpoints.

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5StateDictAdapter.convert_single_tensor_to_hf(
    fqn: str,
    tensor: typing.Any,
    kwargs = {}
) -> list[tuple[str, typing.Any]]
```

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5StateDictAdapter.from_hf(
    hf_state_dict: dict[str, typing.Any],
    kwargs = {}
) -> dict[str, typing.Any]
```

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5StateDictAdapter.to_hf(
    state_dict: dict[str, typing.Any],
    exclude_key_regex: typing.Optional[str] = None,
    kwargs = {}
) -> dict[str, typing.Any]
```

```python
class nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5_MoeStateDictAdapter(
    config: typing.Any,
    moe_config: nemo_automodel.components.moe.config.MoEConfig,
    backend: nemo_automodel.components.models.common.BackendConfig,
    dtype: torch.dtype = torch.bfloat16
)
```

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

Convert ERNIE 4.5 MoE HF checkpoints to AutoModel grouped-expert format.

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5_MoeStateDictAdapter._hf_key_to_native(
    key: str
) -> str
```

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5_MoeStateDictAdapter._native_key_to_hf(
    key: str
) -> str
```

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5_MoeStateDictAdapter.convert_single_tensor_to_hf(
    fqn: str,
    tensor: typing.Any,
    kwargs = {}
) -> list[tuple[str, typing.Any]]
```

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5_MoeStateDictAdapter.from_hf(
    hf_state_dict: dict[str, typing.Any],
    device_mesh: typing.Optional['DeviceMesh'] = None,
    kwargs = {}
) -> dict[str, typing.Any]
```

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.Ernie4_5_MoeStateDictAdapter.to_hf(
    state_dict: dict[str, typing.Any],
    exclude_key_regex: typing.Optional[str] = None,
    quantization: bool = False,
    kwargs = {}
) -> dict[str, typing.Any]
```

```python
nemo_automodel.components.models.ernie4_5.state_dict_adapter.logger = logging.getLogger(__name__)
```