adapter#
Adapter dispatch for checkpoint-native MTP training.
Classes
Identify and load native MTP; FakeBase supplies the frozen target components. |
Functions
Load native MTP weights for offline training through a registered adapter. |
|
Resolve exactly one matching adapter, or validate the explicitly selected one. |
|
Register one named checkpoint implementation; duplicate names are rejected. |
- class NativeMTPAdapter#
Bases:
ABCIdentify and load native MTP; FakeBase supplies the frozen target components.
- classmethod create(model_path, *, dtype, device, config)#
Load the partial target and attach native MTP to shared EAGLE training.
Override for checkpoint layouts or distributed loading that need a specialized FakeBase construction. Never load the target backbone for offline training.
- Parameters:
model_path (str | Path)
dtype (dtype)
device (device | str | None)
config (MTPConfig)
- Return type:
Module
- abstractmethod classmethod load_mtp(model_path, *, dtype, device)#
Load an MTPModule with native config, state layout and placement, without the backbone.
- Parameters:
model_path (str | Path)
dtype (dtype)
device (device | str | None)
- Return type:
Module
- name: str#
- abstractmethod classmethod supports(model_path)#
Identify the architecture from checkpoint metadata without loading weights.
- Parameters:
model_path (str | Path)
- Return type:
bool
- exception NativeMTPCheckpointError#
Bases:
ValueErrorAn unsupported or inconsistent native MTP checkpoint.
- create_native_mtp_boost_model(model_path, *, dtype=torch.bfloat16, device=None, **config_kwargs)#
Load native MTP weights for offline training through a registered adapter.
Additional keyword arguments are validated by
MTPConfig, which defines their defaults.- Parameters:
model_path (str | Path)
dtype (dtype)
device (device | str | None)
- Return type:
Module
- get_native_mtp_adapter(model_path, adapter='auto')#
Resolve exactly one matching adapter, or validate the explicitly selected one.
- Parameters:
model_path (str | Path)
adapter (str)
- Return type:
- register_native_mtp_adapter(adapter)#
Register one named checkpoint implementation; duplicate names are rejected.
- Parameters:
adapter (type[NativeMTPAdapter])
- Return type: