Views
No views yet

meta-llama/Llama-2-13b-hf. For more details, please visit our code repo.from_pretrained:1from transformers import AutoModel
2
3model = AutoModel.from_pretrained("MerantixMomentum/acip_llama2_13b", trust_remote_code=True)model.prune_model_by_score(size_ratio=0.4)model to 40% if its original size measured in number of parameters, i.e., 60% compression rate.
A unique feature of ACIP is that this operation is revertible in the sense that you can rerun model.prune_model_by_score as often as you like to evaluate your model at different sizes. Finally, you can "commit" to a certain ratio and runmodel.compress()model.quantize()bitsandbytes, but you could also customize this).size_ratio ranges from 1.0 to 0.0, indicating the model size after compression. For example, 0.4 means that the model has only 40% of the original number of parameters and 1.0 means no compression at all. Alternatively, you can also set compression_rate in prune_model_by_score, which is equivalent to size_ratio = 1.0 - compression_rate.torch, transformers, peft, and optionally, bitsandbytes in case you want to quantize your model.
See requirements.txt for pip-installable dependencies with exact version pins (newer version should work as well).1@article{mxm2025acip,
2 title={Choose Your Model Size: Any Compression by a Single Gradient Descent},
3 author={M. Genzel, P. Putzky, P. Zhao, S. Schulze, M. Mollenhauer, R. Seidel, S. Dietzel, T. Wollmann},
4 year={2025},
5 journal={Preprint arXiv:2502.01717}
6}