adapter#

Adapter dispatch for checkpoint-native MTP training.

Classes

NativeMTPAdapter

Identify and load native MTP; FakeBase supplies the frozen target components.

Functions

create_native_mtp_boost_model

Load native MTP weights for offline training through a registered adapter.

get_native_mtp_adapter

Resolve exactly one matching adapter, or validate the explicitly selected one.

register_native_mtp_adapter

Register one named checkpoint implementation; duplicate names are rejected.

class NativeMTPAdapter#

Bases: ABC

Identify 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: ValueError

An 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:

type[NativeMTPAdapter]

register_native_mtp_adapter(adapter)#

Register one named checkpoint implementation; duplicate names are rejected.

Parameters:

adapter (type[NativeMTPAdapter])

Return type:

type[NativeMTPAdapter]