mode — Model Optimizer 0.27.1 (original) (raw)

TensorRT Model Optimizer

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.