{"id":37081025,"url":"https://github.com/bomri/pytorch-checkpoint","last_synced_at":"2026-01-14T09:50:23.087Z","repository":{"id":57457890,"uuid":"188251012","full_name":"bomri/pytorch-checkpoint","owner":"bomri","description":"Support PyTorch checkpoints","archived":false,"fork":false,"pushed_at":"2019-06-26T07:56:38.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-21T15:50:44.216Z","etag":null,"topics":["checkpoints","deep-learning","machine-learning","metrics","pytorch","save-model"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bomri.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}},"created_at":"2019-05-23T14:32:59.000Z","updated_at":"2022-03-11T14:00:06.000Z","dependencies_parsed_at":"2022-09-07T03:41:31.889Z","dependency_job_id":null,"html_url":"https://github.com/bomri/pytorch-checkpoint","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bomri/pytorch-checkpoint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bomri%2Fpytorch-checkpoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bomri%2Fpytorch-checkpoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bomri%2Fpytorch-checkpoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bomri%2Fpytorch-checkpoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bomri","download_url":"https://codeload.github.com/bomri/pytorch-checkpoint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bomri%2Fpytorch-checkpoint/sbom","scorecard":{"id":247413,"data":{"date":"2025-08-11","repo":{"name":"github.com/bomri/pytorch-checkpoint","commit":"4372e7034f6f97aeb13a5d1c5f016afbb927ba49"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T07:51:01.928Z","repository_id":57457890,"created_at":"2025-08-17T07:51:01.928Z","updated_at":"2025-08-17T07:51:01.928Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["checkpoints","deep-learning","machine-learning","metrics","pytorch","save-model"],"created_at":"2026-01-14T09:50:22.519Z","updated_at":"2026-01-14T09:50:23.079Z","avatar_url":"https://github.com/bomri.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytorch-checkpoint\n\n[![PyPI version](https://badge.fury.io/py/pytorchcheckpoint.svg)](https://badge.fury.io/py/pytorchcheckpoint)\n\n\nThis package supports saving and loading PyTorch training checkpoints. It is useful when trying the resume model training from a previous step, and can become handy when working with spot instances or when trying to reproduce results.\n\nA model is saved not only with its weights, as one might do for later inference, but the entire state of the model, including the optimizer state and parameters.\n\nIn addition, it allows saving metrics and other values generated while training, such as accuracy and loss values. This makes it possible to recreate the learning curves from past values and continue to update them as training proceed.\n\nSee accompanying blog post here: [Where did I put my loss values?](https://medium.com/p/where-did-i-put-my-loss-values-acf6264ea347?source=email-486b68bc632a--writer.postDistributed\u0026sk=39b0e303a259edd240b0068e41351c34)\n\n------------------\n\n\n## Prerequisites\nDeveloped with **Python 3.7.3**, but should be compatible with previous Python version.\n```\npip install torch==1.1.0 torchvision==0.3.0\n```\n\n## Installation\n```pip install pytorchcheckpoint```\n\n## Usage\n```python\nfrom pytorchcheckpoint.checkpoint import CheckpointHandler\ncheckpoint_handler = CheckpointHandler()\n```\n\n#### Storing a general value\n```python\ncheckpoint_handler.store_var(var_name='num_of_classes', value=1000)\n```\n#### Reading a general value\n```python\nnum_of_classes = checkpoint_handler.get_var(var_name='num_of_classes')\n```\n\n#### Storing values and metrics for each epoch/iteration. For example, the loss value: \n```python\ncheckpoint_handler.store_running_var(var_name='loss', iteration=0, value=1.0)\ncheckpoint_handler.store_running_var(var_name='loss', iteration=1, value=0.9)\ncheckpoint_handler.store_running_var(var_name='loss', iteration=2, value=0.8)\n```\n\n#### Reading stored values for epoch/iteration\n```python\nloss = checkpoint_handler.get_running_var(var_name='loss', iteration=0)\n```\n\n#### Storing values and metrics per set: train/valid/test for each epoch/iteration. For example, the top1 value of the train and valid sets: \n```python\ncheckpoint_handler.store_running_var_with_header(header='train', var_name='top1', iteration=0, value=80)\ncheckpoint_handler.store_running_var_with_header(header='train', var_name='top1', iteration=1, value=85)\ncheckpoint_handler.store_running_var_with_header(header='train', var_name='top1', iteration=2, value=90)\ncheckpoint_handler.store_running_var_with_header(header='train', var_name='top1', iteration=3, value=91)\n\ncheckpoint_handler.store_running_var_with_header(header='valid', var_name='top1', iteration=0, value=70)\ncheckpoint_handler.store_running_var_with_header(header='valid', var_name='top1', iteration=1, value=75)\ncheckpoint_handler.store_running_var_with_header(header='valid', var_name='top1', iteration=2, value=80)\ncheckpoint_handler.store_running_var_with_header(header='valid', var_name='top1', iteration=3, value=85)\n```\n\n#### Reading stored values per set: train/valid/test for epoch/iteration\n```python\nloss = checkpoint_handler.get_running_var_with_header(header='train', var_name='loss', iteration=0)\n```\n\n#### Save checkpoint:\n```python\nimport torchvision.models as models\nfrom torch import optim\ncheckpoint_handler.store_running_var(var_name='loss', iteration=0, value=1.0)\nmodel = models.resnet18()\noptimizer = optim.SGD(model.parameters(), lr=0.001, momentum=0.9)\ncheckpoint_handler.optimizer = optimizer\npath2save = '/tmp'\ncheckpoint_path = checkpoint_handler.generate_checkpoint_path(path2save=path2save)\ncheckpoint_handler.save_checkpoint(checkpoint_path=checkpoint_path, iteration=25, model=model)\n```\n\n#### Load checkpoint:\n```python\ncheckpoint_path = '\u003ccheckpoint_path\u003e'\ncheckpoint_handler = checkpoint_handler.load_checkpoint(checkpoint_path)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbomri%2Fpytorch-checkpoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbomri%2Fpytorch-checkpoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbomri%2Fpytorch-checkpoint/lists"}