模式
稀疏模式描述符。
类
用于描述 |
|
用于定义和描述基于SparseGPT的稀疏化的类。 |
|
用于定义和描述基于幅度的稀疏化的类。 |
函数
用于将模型转换为稀疏元模型的函数。 |
|
将稀疏模型导出为常规模型。 |
|
恢复并导出稀疏模型为常规模型。 |
|
用于将先前转换的模型恢复为稀疏元模型的函数。 |
|
更新子网配置以匹配模型的当前子网配置。 |
- 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:
模型 (模块) –
config (ModeloptBaseConfig) –
- Return type:
元组[模块, 字典[字符串, 任意类型]]
- export_sparse(model, config)
将稀疏模型导出为常规模型。
- Parameters:
模型 (模块) –
config (ExportSparseConfig) –
- Return type:
元组[模块, 字典[字符串, 任意类型]]
- restore_export_sparse(model, config, metadata)
恢复并导出稀疏模型为常规模型。
- Parameters:
模型 (模块) –
config (ExportSparseConfig) –
metadata (Dict[str, Any]) –
- Return type:
模块
- restore_sparse_model(model, config, metadata)
用于将先前转换的模型恢复为稀疏元模型的函数。
- Parameters:
模型 (模块) –
config (ModeloptBaseConfig) –
metadata (Dict[str, Any]) –
- Return type:
模块
- update_sparse_metadata(model, config, metadata)
更新子网配置以匹配模型的当前子网配置。
- Parameters:
模型 (模块) –
config (ModeloptBaseConfig) –
metadata (Dict[str, Any]) –
- Return type:
无