nemo_automodel.components.models.ernie5_5.mtp_state_dict_adapter
nemo_automodel.components.models.ernie5_5.mtp_state_dict_adapter
Whole-state, unsharded checkpoint layout for one-depth ERNIE 5.5 MTP.
The decoder conversion is delegated to its existing adapter. Shared MTP body keys are export aliases only; native storage has no duplicate body parameters. Low-memory/in-place DCP loading and streaming consolidation are not established by this whole-state adapter. Native state_dict save/restore does not require this adapter.
Module Contents
Classes
Functions
Data
API
Bases: StateDictAdapter
Map eight owned parameters, one bias and shared export aliases exactly.
Reject streaming export until its full alias/decoder contract is implemented.
Parameters:
Native tensor name.
Tensor in the native parameter’s semantic layout.
Framework compatibility options.
Returns: list[tuple[str, torch.Tensor]]
No result; this adapter supports whole-state conversion only.
Raises:
NotImplementedError: Single-tensor conversion cannot construct the complete shared-body HF layout.
Convert a complete HF mapping, refusing conflicting shared copies.
Parameters:
Whole unsharded HF tensors; decoder keys and MTP body keys have matching shapes/dtypes/values. The owned head matrix has HF shape [streams * hidden, streams]. Meta inputs are unsupported.
Must be None for this whole-state conversion.
Compatibility options forwarded to the decoder adapter.
Returns: dict[str, torch.Tensor]
Unique native tensors in registered layouts; the owned head matrix
Raises:
NotImplementedError: If the HF mapping contains sharded tensors.ValueError: If required keys are missing, layouts are invalid or shared copies differ from their owners.
Export the whole native state without copying shared body storage.
Parameters:
Unsharded native tensors in their registered layouts; decoder tensors have model.* names and MTP-owned tensors mtp.*. mHC head projection is [streams, streams * hidden] natively.
Must be False.
Must be False; in-place load sessions are not supported.
Must be False.
Checkpointer compatibility arguments passed to the decoder adapter.
Returns: dict[str, torch.Tensor]
HF tensor layouts, including [streams * hidden, streams] MTP head
Raises:
NotImplementedError: If load destinations, quantization or sharded tensors are requested.ValueError: If the eight owned parameters and persistent router bias are not present exactly once.
Use the released extra nesting for the ten shared hyper-connection tensors.