nemo_automodel.components.checkpoint.state_dict_adapter
nemo_automodel.components.checkpoint.state_dict_adapter
Module Contents
Classes
API
Abstract base class for state dict transformations.
This class defines the interface for converting between native model state dict format and other model state dict formats.
Whether all checkpoint-load destinations write through to final model storage.
Adapters should set _supports_write_through_checkpoint_load only when every tensor produced by
to_hf for base-checkpoint loading is either the original model tensor or a view that writes through
to it. The checkpoint loader uses this guarantee to avoid materializing a converted full state dict on
the host.
Convert a single tensor from native format to HuggingFace format.
Parameters:
Fully qualified name of the tensor in native format
The tensor to convert
Additional arguments for conversion
Returns: list[tuple[str, Any]]
List of (fqn, tensor) tuples in HuggingFace format.
Obtain native model state dict from HuggingFace format.
Parameters:
The HuggingFace format state dict
Optional device mesh for DTensor expert parallelism. If provided, only loads experts needed for the current rank.
Returns: dict[str, Any]
The converted native model state dict
Return the Hugging Face keys produced by to_hf.
Parameters:
Native model state mapping. Tensor values may have arbitrary rank and axis order and retain their exact parameter or buffer layouts.
Returns: list[str]
Hugging Face state-dict keys in adapter iteration order.
Convert from native model state dict to HuggingFace format.
Parameters:
The native model state dict
Returns: dict[str, Any]
The converted HuggingFace format state dict