模式

稀疏模式描述符。

ExportSparseModeDescriptor

用于描述"export_sparse"模式的类。

SparseGPTModeDescriptor

用于定义和描述基于SparseGPT的稀疏化的类。

SparseMagnitudeModeDescriptor

用于定义和描述基于幅度的稀疏化的类。

函数

convert_sparse_model

用于将模型转换为稀疏元模型的函数。

export_sparse

将稀疏模型导出为常规模型。

restore_export_sparse

恢复并导出稀疏模型为常规模型。

restore_sparse_model

用于将先前转换的模型恢复为稀疏元模型的函数。

update_sparse_metadata

更新子网配置以匹配模型的当前子网配置。

class ExportSparseModeDescriptor

基础:_ModeDescriptor

用于描述"export_sparse"模式的类。

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

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 SparseGPTModeDescriptor

基础:SparseMagnitudeModeDescriptor

用于定义和描述基于SparseGPT的稀疏化的类。

property config_class: Type[ModeloptBaseConfig]

指定模式的配置类。

property name: str

返回模式的名称。

property search_algorithm: Type[BaseSearcher]

指定模式的搜索算法。

class SparseMagnitudeModeDescriptor

基础:_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 search_algorithm: Type[BaseSearcher]

指定模式的搜索算法。

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

模式的入口点,用于更新模型的元数据。

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

模式的入口点,用于更新模型的元数据。

convert_sparse_model(model, config)

用于将模型转换为稀疏元模型的函数。

Parameters:
Return type:

元组[模块, 字典[字符串, 任意类型]]

export_sparse(model, config)

将稀疏模型导出为常规模型。

Parameters:
Return type:

元组[模块, 字典[字符串, 任意类型]]

restore_export_sparse(model, config, metadata)

恢复并导出稀疏模型为常规模型。

Parameters:
Return type:

模块

restore_sparse_model(model, config, metadata)

用于将先前转换的模型恢复为稀疏元模型的函数。

Parameters:
Return type:

模块

update_sparse_metadata(model, config, metadata)

更新子网配置以匹配模型的当前子网配置。

Parameters:
Return type: