https://github.com/evcu/pytorchpruner
https://github.com/evcu/pytorchpruner
hessian masking pruning python pytorch
Last synced: 24 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/evcu/pytorchpruner
- Owner: evcu
- License: mit
- Created: 2018-01-28T21:42:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-27T23:02:25.000Z (over 7 years ago)
- Last Synced: 2025-04-01T23:52:07.737Z (6 months ago)
- Topics: hessian, masking, pruning, python, pytorch
- Language: Python
- Size: 37.1 KB
- Stars: 22
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# pytorchpruner
Do `python setup.py install` to install.
Check `notebooks/` for samples.`pytorchpruner` is a [pytorch](https://pytorch.org/) package for pruning neural networks. It is intended for research and its main objective is not to provide fastest pruning framework, however it is relatively efficient and fast. It uses masking idea to simulate pruning and supports two main pruning strategies. It also implements various second order functions like hessian and hessian-vector product.
There are X main parts of the library
1. **Parameter Pruning (pytorchpruner.scorers)**: Saliency measures that return a same-sized-tensor of scores for each parameter in the provided parameter tensor.
2. **Unit Pruning (pytorchpruner.unitscorers)**: Saliency measures that return a vector of scores for each unit in the provided parameter tensor.
3. **Pruners (pytorchpruner.pruners)**: Has two different pruner engine for the two different pruning strategies (parameter vs unit). `remove_empty_filters` function in this file reduces the size of the network by copying the parameters into smaller tensors if possible.
4. **Auxiliary Modules (pytorchpruner.modules)**: implements `meanOutputReplacer` and `maskedModule`, the two important wrapper for `torch.nn.Module` instances. The first one replaces its output with the mean value, if enabled. And the second one simulates the pruning layers.
5. **Various first/second-order functionality (pytorchpruner.utils)**: implements hessian calculation, hessian-vector product, search functionality and some other utility functions.