Comments (3)
So you can either use torch_summary(package) if you want all the parameter details and model size which outputs something like this
if you only want size you can do something like this
def print_size_of_model(model):
torch.save(model.state_dict(), "temp.p")
print('Size (MB):', os.path.getsize("temp.p")/1e6)
os.remove('temp.p')
print_size_of_model(model)
from torch-pruning.
By using the print_size_of_model method, the pruned model size shown did'nt reduce because I think this is cause by even the value is prune (turn to 0),but is still store with fp32. So I wonder how did you get your pruned model size?
from torch-pruning.
Yeah so you're using Pytorch's pruning which is unstructured . what unstructured pruning does is that it will put zeros in your weight matrix but it won't remove them. In essence you have a sparse matrix but you're still saving the zeros(those floating point fp32's). If you want model size reduction use this library(torch_pruning), which uses structured pruning or you might want to look into quantization
from torch-pruning.
Related Issues (20)
- Why are the layers in ignored_layers still pruned? HOT 5
- IndexError: index 512 is out of bounds for dimension 0 with size 512 HOT 2
- There is a significant difference in the inference effect of YOLOv5 after pruning
- > 我在执行过程中遇到代码错误,指出张量不在同一设备上。@Hyunseok-Kim0你能给我解释一下吗,谢谢 HOT 3
- custom elementwise add
- Regarding the accuracy after pruning
- GroupNormPruner for sparse training
- torchvision.swinb 剪枝 HOT 1
- yolov5 can not detect things after pruning
- if this method is suitable for pruning fully connected neural networks (FCNN)?
- I got same MACs and Params between before and after when purning yolov7-tiny HOT 1
- 使用flash_attn 优化后的 vit进行剪枝,出现尺寸不匹配的问题。
- How to use torch prunning with tensorflow model?
- 请问你们这篇论文group Norm 这个方法不需要稀疏化,是怎么实现的,和论文里的需要稀疏化的方法有什么区别呢
- 剪枝yolov8模型 报错 统计参数奔溃 concat算子报错
- Question: Why is Eigendamage and FPGM not docummented nor exposed in importance.py HOT 1
- Prune Swin Transfomer:Could not find image processor class in the image processor config or the model config.
- Pruned Yolov8 model not loading? HOT 3
- detecting unwrapped parameters HOT 1
- AttributeError: Can't get attribute '__main__' on <module 'builtins' (built-in)>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torch-pruning.