mode

Module implementing and describing modes that can be used during the NAS convert process.

Check out mtn.convert to learn more about modes.

Classes

ExportStudentModeDescriptor

Class to describe the specific Export mode to be used with Knowledge Distillation.

KnowledgeDistillationModeDescriptor

Class to describe the Knowledge-Distillation mode.

class ExportStudentModeDescriptor

Bases: _ModeDescriptor

Class to describe the specific Export mode to be used with Knowledge Distillation.

The properties of this mode can be inspected via the source code.

property config_class: Type[ModeloptBaseConfig]

Specifies the config class for the mode.

property convert: Callable[[Module, ModeloptBaseConfig], 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 KnowledgeDistillationModeDescriptor

Bases: _ModeDescriptor

Class to describe the Knowledge-Distillation mode.

The properties of this mode can be inspected via the source code.

property config_class: Type[ModeloptBaseConfig]

Specifies the config class for the mode.

property convert: Callable[[Module, ModeloptBaseConfig], Tuple[Module, Dict[str, Any]]]

The mode’s entrypoint for converting a model.

property export_mode: str | None

The mode that corresponds to the export mode of this mode.

property name: str

Returns the value (str representation) of the mode.

property next_modes: Set[str] | None

Modes that must immediately follow this 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 for adding new mode.