{"id":21389495,"url":"https://github.com/feifeibear/ckp_training","last_synced_at":"2025-06-20T06:06:50.525Z","repository":{"id":85016946,"uuid":"360038951","full_name":"feifeibear/ckp_training","owner":"feifeibear","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-21T08:18:39.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T12:46:52.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/feifeibear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-21T05:08:26.000Z","updated_at":"2021-04-21T11:14:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b7a350e-d3ba-4620-bcac-c85a4ed2507c","html_url":"https://github.com/feifeibear/ckp_training","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/feifeibear/ckp_training","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifeibear%2Fckp_training","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifeibear%2Fckp_training/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifeibear%2Fckp_training/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifeibear%2Fckp_training/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feifeibear","download_url":"https://codeload.github.com/feifeibear/ckp_training/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifeibear%2Fckp_training/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260891141,"owners_count":23077910,"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-11-22T12:26:46.616Z","updated_at":"2025-06-20T06:06:45.509Z","avatar_url":"https://github.com/feifeibear.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 测试checkpoint对模型训练的作用\n使用\n[TORCH.UTILS.CHECKPOINT](https://pytorch.org/docs/stable/checkpoint.html)\n来减少activations的显存占用。\n\n\n#### 测试方法\n将一个4层全连接网络的前两层用checkpoint优化。\n\n在项目的根目录\n\n`export PYTHONPATH=$PYTHONPATH:$PWD`\n\n运行\n\n`tests/test_ckp.py [--use_ckp] [--use_fp16] [--res_check]`\n\n#### 结果\nFP16不使用checkpoint优化(MA = Memory Allocation. CA = Cached Allocation)\n\nMA 232.0 KB         Max_MA 245.5 KB         CA 2048.0 KB         Max_CA 2048 KB\n\n使用checkpoint优化\n\nMA 188.0 KB         Max_MA 201.5 KB         CA 2048.0 KB         Max_CA 2048 KB\n\n显存使用有显著减少\n\n#### 参考\n[Megatron的checkpoint实现](https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/mpu/random.py#L316)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeifeibear%2Fckp_training","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeifeibear%2Fckp_training","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeifeibear%2Fckp_training/lists"}