模式

模块实现并描述了在NAS转换过程中可以使用的模式。

查看mtn.convert以了解更多关于模式的信息。

ExportStudentModeDescriptor

用于描述与知识蒸馏一起使用的特定导出模式的类。

KnowledgeDistillationModeDescriptor

用于描述知识蒸馏模式的类。

class ExportStudentModeDescriptor

基础:_ModeDescriptor

用于描述与知识蒸馏一起使用的特定导出模式的类。

此模式的属性可以通过源代码进行检查。

property config_class: Type[ModeloptBaseConfig]

指定模式的配置类。

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

模式的入口点,用于转换模型。

property is_export_mode: bool

指定模式是否为导出模式。

property name: str

返回模式的值(字符串表示)。

property restore: Callable[[Module, ModeloptBaseConfig, Dict[str, Any]], Module]

模式的入口点,用于恢复模型。

class KnowledgeDistillationModeDescriptor

基础:_ModeDescriptor

用于描述知识蒸馏模式的类。

此模式的属性可以通过源代码进行检查。

property config_class: Type[ModeloptBaseConfig]

指定模式的配置类。

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

模式的入口点,用于转换模型。

property export_mode: str | None

与此模式的导出模式相对应的模式。

property name: str

返回模式的值(字符串表示)。

property next_modes: Set[str] | None

必须立即跟随此模式的模式。

property restore: Callable[[Module, ModeloptBaseConfig, Dict[str, Any]], Module]

模式的入口点,用于恢复模型。

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

模式的入口点,用于更新模型状态以添加新模式。