{"id":22894222,"url":"https://github.com/zib-iol/sms","last_synced_at":"2025-04-15T01:36:05.577Z","repository":{"id":176968800,"uuid":"657996077","full_name":"ZIB-IOL/SMS","owner":"ZIB-IOL","description":"Code to reproduce the experiments of the ICLR24-paper: \"Sparse Model Soups: A Recipe for Improved Pruning via Model Averaging\"","archived":false,"fork":false,"pushed_at":"2024-10-17T09:56:15.000Z","size":59,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T13:37:18.592Z","etag":null,"topics":["averaging","deep-learning","neural-network","optimization","pruning","pytorch","sparsity"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZIB-IOL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"citation.bib","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-24T12:50:23.000Z","updated_at":"2025-03-18T13:24:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef3302c8-48fa-4b1f-a7b7-495a475cf5a9","html_url":"https://github.com/ZIB-IOL/SMS","commit_stats":null,"previous_names":["zib-iol/sms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZIB-IOL%2FSMS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZIB-IOL%2FSMS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZIB-IOL%2FSMS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZIB-IOL%2FSMS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZIB-IOL","download_url":"https://codeload.github.com/ZIB-IOL/SMS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248989874,"owners_count":21194660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["averaging","deep-learning","neural-network","optimization","pruning","pytorch","sparsity"],"created_at":"2024-12-13T23:17:14.407Z","updated_at":"2025-04-15T01:36:05.556Z","avatar_url":"https://github.com/ZIB-IOL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## [ICLR24] Sparse Model Soups: A Recipe for Improved Pruning via Model Averaging\n\n*Authors: [Max Zimmer](https://maxzimmer.org/), [Christoph Spiegel](http://www.christophspiegel.berlin/), [Sebastian Pokutta](http://www.pokutta.com/)*\n\nThis repository contains the code to reproduce the experiments from the ICLR24 paper [\"Sparse Model Soups: A Recipe for Improved Pruning via Model Averaging\"](https://arxiv.org/abs/2306.16788).\nThe code is based on [PyTorch 1.9](https://pytorch.org/) and the experiment-tracking platform [Weights \u0026 Biases](https://wandb.ai). See the [blog post](https://www.pokutta.com/blog/research/2023/08/05/abstract-SMS.html) or the [twitter thread](https://x.com/maxzimmerberlin/status/1787052536442077479) for a TL;DR.\n\n### Structure and Usage\n#### Structure\nExperiments are started from the following file:\n\n- [`main.py`](main.py): Starts experiments using the dictionary format of Weights \u0026 Biases.\n\nThe rest of the project is structured as follows:\n\n- [`strategies`](strategies): Contains the strategies used for training, pruning and model averaging.\n- [`runners`](runners): Contains classes to control the training and collection of metrics.\n- [`metrics`](metrics): Contains all metrics as well as FLOP computation methods.\n- [`models`](models): Contains all model architectures used.\n- [`utilities`](models): Contains useful auxiliary functions and classes.\n\n#### Usage\nAn entire experiment is subdivided into multiple steps, each being multiple (potentially many) different runs and wandb experiments. First of all, a model has to be pretrained using the `Dense` strategy. This steps is completely agnostic to any pruning specifications. Then, for each phase or prune-retrain-cycle (specified by the `n_phases` parameter and controlled by `phase` parameter), the following steps are executed:\n1. Strategy `IMP`: Prune the model using the IMP strategy. Here, it is important to specify the `ensemble_by`, `split_val` and `n_splits_total` parameters:\n   - `ensemble_by`: The parameter which is varied when retraining multiple models. E.g. setting this to `weight_decay` will train multiple models with different weight decay values.\n   - `split_val`: The value by which the `ensemble_by` parameter is split. E.g. setting this to 0.0001 while using `weight_decay` as `ensemble_by` will retrain a model with weight decay 0.0001, all else being equal.\n   - `n_splits_total`: The total number of splits for the `ensemble_by` parameter. If set to three, the souping operation in the next step will expect three models to be present, given the `ensemble_by` configuration.\n2. Strategy `Ensemble`: Souping the models. This step will average the weights of the models specified by the `ensemble_by` parameter. The `ensemble_by` parameter has to be the same as in the previous step. `n_splits_total` has to be the same as well. `split_val` is not used in this step and has to be set to None. The `ensemble_method` parameter controls how the models are averaged.\n\n### Citation\n\nIn case you find the paper or the implementation useful for your own research, please consider citing:\n\n```\n@inproceedings{zimmer2024sparse,\ntitle={Sparse Model Soups: A Recipe for Improved Pruning via Model Averaging},\nauthor={Max Zimmer and Christoph Spiegel and Sebastian Pokutta},\nbooktitle={The Twelfth International Conference on Learning Representations},\nyear={2024},\nurl={https://openreview.net/forum?id=xx0ITyHp3u}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzib-iol%2Fsms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzib-iol%2Fsms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzib-iol%2Fsms/lists"}