{"id":13936886,"url":"https://github.com/dmlc/mxnet-memonger","last_synced_at":"2025-10-17T15:54:33.840Z","repository":{"id":66049431,"uuid":"56810814","full_name":"dmlc/mxnet-memonger","owner":"dmlc","description":"Sublinear memory optimization for deep learning, reduce GPU memory cost to train deeper nets","archived":false,"fork":false,"pushed_at":"2017-08-08T15:42:14.000Z","size":12,"stargazers_count":308,"open_issues_count":9,"forks_count":63,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-02T11:54:27.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmlc.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}},"created_at":"2016-04-21T23:04:40.000Z","updated_at":"2025-02-20T13:54:41.000Z","dependencies_parsed_at":"2023-02-21T03:00:26.541Z","dependency_job_id":null,"html_url":"https://github.com/dmlc/mxnet-memonger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmlc%2Fmxnet-memonger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmlc%2Fmxnet-memonger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmlc%2Fmxnet-memonger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmlc%2Fmxnet-memonger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmlc","download_url":"https://codeload.github.com/dmlc/mxnet-memonger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075998,"owners_count":21043684,"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":[],"created_at":"2024-08-07T23:03:05.404Z","updated_at":"2025-10-17T15:54:33.756Z","avatar_url":"https://github.com/dmlc.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# MXNet Memory Monger\n\nThis project contains a 150 lines of python script to give sublinear memory plans of deep neural networks.\nThis allows you to trade computation for memory and get sublinear memory cost,\nso you can train bigger/deeper nets with limited resources.\n\n## Reference Paper\n\n[Training Deep Nets with Sublinear Memory Cost](https://arxiv.org/abs/1604.06174) Arxiv 1604.06174\n\n## How to Use\n\nThis code is based on [MXNet](https://github.com/dmlc/mxnet), a lightweight, flexible and efficient framework for deep learning.\n\n- Configure your network as you normally will do using symbolic API\n- Give hint to the allocator about the possible places that we need to bookkeep computations.\n  - Set attribute ```mirror_stage='True'```, see [example_resnet.py](example_resnet.py#L25)\n  - The memonger will try to find possible dividing points on the nodes that are annotated as mirror_stage.\n- Call ```memonger.search_plan``` to get an symbolic graph with memory plan.\n\n```python\nimport mxnet as mx\nimport memonger\n\n# configure your network\nnet = my_symbol()\n\n# call memory optimizer to search possible memory plan.\nnet_planned = memonger.search_plan(net)\n\n# use as normal\nmodel = mx.FeedForward(net_planned, ...)\nmodel.fit(...)\n```\n\n## Write your Own Memory Optimizer\n\nMXNet's symbolic graph support attribute to give hint on whether (mirror attribute) a result\ncan be recomputed or not. You can choose to re-compute instead of remembering a result\nfor less memory consumption. To set output of a symbol to be re-computable, use\n```python\nsym._set_attr(force_mirroring='True')\n```\n\nmxnet-memonger actually use the same way to do memory planning. You can simply write your own memory\nallocator by setting the force_mirroring attribute in a smart way.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmlc%2Fmxnet-memonger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmlc%2Fmxnet-memonger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmlc%2Fmxnet-memonger/lists"}