mode#

PEFT mode descriptors for model optimization.

Classes

ExportPEFTModeDescriptor

Mode descriptor for exporting PEFT models.

PEFTModeDescriptor

Mode descriptor for PEFT (Parameter-Efficient Fine-Tuning) mode.

class ExportPEFTModeDescriptor#

Bases: ModeDescriptor

Mode descriptor for exporting PEFT models.

property config_class: type[ModeloptBaseConfig]#

Specifies the config class for the mode.

property convert: Callable[[Module, ModeloptBaseConfig], tuple[Module, dict[str, Any]]] | Callable[[Module, ModeloptBaseConfig, Any], tuple[Module, dict[str, Any]]]#

The mode’s entrypoint for converting a model.

property is_export_mode: bool#

Specifies whether the mode is an export mode.

property name: str#

Returns the value (str representation) of the mode.

property restore: Callable[[Module, ModeloptBaseConfig, dict[str, Any]], Module]#

The mode’s entrypoint for restoring a model.

class PEFTModeDescriptor#

Bases: ModeDescriptor

Mode descriptor for PEFT (Parameter-Efficient Fine-Tuning) mode.

property config_class: type[ModeloptBaseConfig]#

Specifies the config class for the mode.

property convert: Callable[[Module, ModeloptBaseConfig], tuple[Module, dict[str, Any]]] | Callable[[Module, ModeloptBaseConfig, Any], tuple[Module, dict[str, Any]]]#

The mode’s entrypoint for converting a model.

property export_mode: str | None#

Specifies the export mode name for this mode.

property name: str#

Returns the value (str representation) of the mode.

property restore: Callable[[Module, ModeloptBaseConfig, dict[str, Any]], Module]#

The mode’s entrypoint for restoring a model.

property update_for_new_mode: Callable[[Module, ModeloptBaseConfig, dict[str, Any]], None]#

The mode’s entrypoint for updating the models state before new mode.

property update_for_save: Callable[[Module, ModeloptBaseConfig, dict[str, Any]], None]#

The mode’s entrypoint for updating the model’s state before saving.