sparsegpt#
Utility functions of SparseGPT.
Classes
SparseGPT-based sparse mask searching algorithm. |
Functions
Create a sparse mask for the given tensor. |
|
Invert a Hessian matrix. |
|
Prepare the inverse Hessian matrix. |
- class SparseGPTSearcher#
Bases:
BaseSparseSearcherSparseGPT-based sparse mask searching algorithm.
- after_search()#
Remove Hessian artifacts from network.
- before_search()#
Register the forward hook to collect the hessian matrix.
- property default_search_config: dict[str, Any]#
Get the default config for the searcher.
- create_sgpt_mask(tensor, hessian, config)#
Create a sparse mask for the given tensor.
- Parameters:
tensor (Tensor)
hessian (Tensor)
config (dict[str, Any])
- Return type:
Tensor
- invert(hessian)#
Invert a Hessian matrix.
- Parameters:
hessian (Tensor)
- Return type:
Tensor
- prepare(tensor, hessian, hessian_damp)#
Prepare the inverse Hessian matrix.
- Parameters:
tensor (Tensor)
hessian (Tensor)
hessian_damp (float)
- Return type:
tuple[Tensor, Tensor]