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.
- config: dict[str, Any]
- constraints: dict[str, str | float | dict | None]
- property default_search_config: dict[str, Any]
Get the default config for the searcher.
- deployment: dict[str, str] | None
- dummy_input: Any | tuple
- forward_loop: Callable[[Module], None] | None
- model: Module
- 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]