{"id":28988716,"url":"https://github.com/eidoslab/simplify","last_synced_at":"2025-06-24T22:06:39.441Z","repository":{"id":41083482,"uuid":"364052918","full_name":"EIDOSLAB/simplify","owner":"EIDOSLAB","description":"Simplification of pruned models for accelerated inference | SoftwareX https://doi.org/10.1016/j.softx.2021.100907","archived":false,"fork":false,"pushed_at":"2025-02-25T09:57:23.000Z","size":2109,"stargazers_count":36,"open_issues_count":6,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-30T06:04:35.250Z","etag":null,"topics":["deep-learning","optimization","pruning"],"latest_commit_sha":null,"homepage":"https://doi.org/10.1016/j.softx.2021.100907","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EIDOSLAB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-03T20:28:53.000Z","updated_at":"2025-03-31T07:25:42.000Z","dependencies_parsed_at":"2025-02-25T10:30:04.370Z","dependency_job_id":"378b15a1-c735-444e-b28e-544d67f8fccc","html_url":"https://github.com/EIDOSLAB/simplify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/EIDOSLAB/simplify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fsimplify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fsimplify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fsimplify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fsimplify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EIDOSLAB","download_url":"https://codeload.github.com/EIDOSLAB/simplify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fsimplify/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261764387,"owners_count":23206255,"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":["deep-learning","optimization","pruning"],"created_at":"2025-06-24T22:06:38.675Z","updated_at":"2025-06-24T22:06:39.428Z","avatar_url":"https://github.com/EIDOSLAB.png","language":"Python","readme":"# Simplify\n\n[comment]: \u003c\u003e ([![tests]\u0026#40;https://github.com/EIDOSlab/simplify/actions/workflows/test.yaml/badge.svg\u0026#41;]\u0026#40;https://github.com/EIDOSlab/simplify/actions/workflows/test.yaml\u0026#41;)\n\nSimplification of pruned models for accelerated inference.\n\nFully supports torchvision classification models up\nto [version 0.11](https://pytorch.org/vision/0.11/models.html#classification).\n\n## Installation\n\nSimplify can be installed using pip:\n\n```bash\npip3 install torch-simplify\n```\n\nor if you want to run the latest version of the code, you can install from git:\n\n```bash\ngit clone https://github.com/EIDOSlab/simplify\ncd simplify\npip3 install -r requirements.txt\n```\n\n****\n\n## Usage\n\n### Main function\n\nFor most scenarios the main `simplify` function will suffice. This function returns the simplified model.\n\n#### Arguments\n\nThe expected arguments are:\n\n- `model (torch.nn.Module)`: Module to be simplified i.e. the PyTorch's model.\n- `x (torch.Tensor)`: zero-tensor of shape `[1, C, N, M]`, same as the model usual input.\n- `bn_folding (List)`: List of tuple (`nn.Conv2d`, `nn.BatchNorm2d`) to be fused. If None it tries to evaluate them\n  given the model. Default `None`.\n- `fuse_bn (bool)`: If True, fuse the conv-bn tuple.\n- `pinned_out (List)`: List of `nn.Modules` which output needs to remain of the original shape (e.g. layers related to a\n  residual connection with a sum operation).\n\n#### Minimal working example\n\n```python\nimport torch\nfrom torchvision import models\nfrom simplify import simplify\n\nmodel = models.resnet18()\n\n# Apply some pruning strategy or load a pruned checkpoint\n\ndummy_input = torch.zeros(1, 3, 224, 224)  # Tensor shape is that of a standard input for the given model\nsimplified_model = simplify(model, dummy_input)\n```\n\n### Submodules\n\nThe `simplify` function is composed of three different submodules: `fuse`, `propagate` and `remove`. Each module can be\nused independently as needed.\n\n#### fuse\n\nFuses adjacent Conv (or Linear) and BatchNorm layers.\n\n#### propagate\n\nPropagates non-zero bias of pruned neurons to remaining neurons of the next layers.\n\n#### remove\n\nRemoves zeroed neurons from the architecture.\n\n****\n\n## Citing\n\nIf you use this software for research or application purposes, please use the following citation:\n\n```bibtex\n@article{bragagnolo2021simplify,\n  title = {Simplify: A Python library for optimizing pruned neural networks},\n  journal = {SoftwareX},\n  volume = {17},\n  pages = {100907},\n  year = {2022},\n  issn = {2352-7110},\n  doi = {https://doi.org/10.1016/j.softx.2021.100907},\n  url = {https://www.sciencedirect.com/science/article/pii/S2352711021001576},\n  author = {Andrea Bragagnolo and Carlo Alberto Barbano},\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidoslab%2Fsimplify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feidoslab%2Fsimplify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidoslab%2Fsimplify/lists"}