nemo_automodel.components.models.qwen3.state_dict_adapter

View as Markdown

Passthrough state-dict adapter for dense Qwen3 checkpoints.

Module Contents

Classes

NameDescription
Qwen3StateDictAdapterConvert dense Qwen3 checkpoints whose HuggingFace and NeMo keys match.

API

class nemo_automodel.components.models.qwen3.state_dict_adapter.Qwen3StateDictAdapter(
config: transformers.Qwen3Config
)

Convert dense Qwen3 checkpoints whose HuggingFace and NeMo keys match.

nemo_automodel.components.models.qwen3.state_dict_adapter.Qwen3StateDictAdapter.from_hf(
hf_state_dict: dict[str, torch.Tensor],
kwargs: object = {}
) -> dict[str, torch.Tensor]

Copy a HuggingFace state dict and materialize a tied LM head if needed.

Parameters:

hf_state_dict
dict[str, torch.Tensor]

Mapping from parameter names to checkpoint tensors. Tensor shapes, dtypes, devices, and storage aliases are preserved.

**kwargs
objectDefaults to {}

Compatibility arguments accepted by the checkpoint adapter interface; they do not alter dense Qwen3 tensors.

Returns: dict[str, torch.Tensor]

A new mapping with the same tensor values and arbitrary parameter

nemo_automodel.components.models.qwen3.state_dict_adapter.Qwen3StateDictAdapter.to_hf(
state_dict: dict[str, torch.Tensor],
exclude_key_regex: str | None = None,
kwargs: object = {}
) -> dict[str, torch.Tensor]

Copy a NeMo state dict, optionally excluding matching keys.

Parameters:

state_dict
dict[str, torch.Tensor]

Mapping from parameter names to checkpoint tensors with arbitrary parameter shapes; values are returned without mutation.

exclude_key_regex
str | NoneDefaults to None

Optional regular expression selecting keys to omit.

**kwargs
objectDefaults to {}

Compatibility arguments accepted by the checkpoint adapter interface; they do not alter dense Qwen3 tensors.

Returns: dict[str, torch.Tensor]

A new HuggingFace-format mapping whose tensor shapes, dtypes,