nemo_automodel.components.models.gemma4_unified.state_dict_adapter
nemo_automodel.components.models.gemma4_unified.state_dict_adapter
State-dict key translation for Hugging Face-native Gemma4 Unified models.
Module Contents
Classes
Functions
Data
API
Bases: StateDictAdapter
Translate Gemma4 Unified keys between model and published HF names.
Rename one model tensor without changing its layout or storage.
Parameters:
Fully qualified native model tensor name.
Tensor-like value of arbitrary rank. Its shape, dtype, device, strides, and storage are preserved exactly.
Adapter-interface arguments. exclude_key_regex may contain
an optional regular expression for keys to omit.
Returns: list[tuple[str, Any]]
An empty list when excluded, otherwise one (hf_fqn, tensor) pair
Rename published Hugging Face FQNs back to model FQNs.
Parameters:
Hugging Face state mapping. Tensor values may have arbitrary rank and retain their exact shape, dtype, device, and storage.
Unused; Gemma4 Unified renames keys without changing tensor placement.
Unused adapter-interface arguments.
Returns: dict[str, Any]
A new model-keyed mapping whose tensor values alias the inputs.
Rename model FQNs to published Hugging Face FQNs.
Parameters:
Native model state mapping. Tensor values may have arbitrary rank and retain their exact shape, dtype, device, and storage.
Optional regular expression for keys to omit.
Unused adapter-interface arguments.
Returns: dict[str, Any]
A new Hugging Face-keyed mapping whose tensor values alias the inputs.
Rename one state-dict key while preserving an optional model. prefix.
Return a state dict with renamed keys and unchanged tensor values.
Parameters:
State mapping whose tensor values retain their original shape, dtype, device, and storage.
Source-prefix to target-prefix mapping.
Returns: dict[str, Any]
A new mapping whose values alias the input values exactly.
Raises:
ValueError: If two source keys map to the same output key.