torch_checkpointing
High-performance asynchronous checkpointing for PyTorch. It takes checkpoint saving off your training loop's critical path:
- Zero-overhead saves —
save()returns immediately; model state is staged off the training device and written by a background process while your training step keeps running. - Save and load through one API — a single
CheckpointManagerdrives both; you pass plain{name: value}dicts and decide when to block on a save (for example, before exit). - Single-rank to distributed — the same API scales from one process to large distributed jobs, and reshards across different parallelism layouts on load.
You interact with one object, CheckpointManager: save(checkpoint_id, {...})
and load(checkpoint_id, into={...}) over a pluggable storage backend. A
checkpoint_id is a string interpreted by that backend; the default local
filesystem backend treats it as the path to a checkpoint directory. Rank,
storage, sharding metadata, and per-item copy/reshard behavior are configured
for you. Power users can still swap in bespoke components — storage backends,
resharders, cross-rank coordination — through the
extension points.
Experimental and pre-1.0. The public API may still change.
Installation
pip install torch_checkpointing
Requires Python >= 3.10 and torch >= 2.6.
Saving is asynchronous by default. The optimized async staging defaults currently require CUDA; CPU-only users should use the explicit configuration in Troubleshooting.
Key features
- Non-blocking async saves overlapped with training (host-side staging + a background-process write).
- One high-level
CheckpointManagerfor both save and load, with auto-detected rank, storage, and metadata. - Plain-dict payloads:
save(id, {...})/load(id, into={...})— tensors restored in place (identity preserved), scalars and JSON/bytes are first-class top-level items. - Resharding on load across different distributed layouts (mesh / placement changes), wired automatically when an item declares a resharder.
- Pluggable storage behind the
Storage/StorageConfiginterface; a local filesystem backend ships in the package.
Documentation
Getting started
- Tutorial — checkpoint and resume a complete training loop.
- Overview — what the library does and how the pieces fit together.
- Key concepts — the
CheckpointManager, the payload/into=model, and how async save and load work. - Configuring checkpoints — per-item
layout,requires_copy, andresharderviaItemSpec. - Troubleshooting & FAQ — common errors and how to fix them.
- API reference — the public symbols at a glance.
Building bespoke components (power users)
- Extensibility — the extension points, and how to plug in your own infrastructure.
- Storage — the
Storage/StorageConfiginterface and writing a custom backend. - Distributed and resharding — multi-rank saves and custom resharding across mesh/placement changes.
- Design & internals — the async staging and background-write architecture.
Contributing
- Contributing — development setup, testing, and pull-request guidance.
License
BSD 3-Clause License. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_checkpointing-0.1.0.tar.gz.
File metadata
- Download URL: torch_checkpointing-0.1.0.tar.gz
- Upload date:
- Size: 181.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
304725d78f7c110c521cfdb92357df371a423a0168d38f367cede63c122aea73
|
|
| MD5 |
d20861ab0236e330d25d7fe324210e0e
|
|
| BLAKE2b-256 |
85f7c16752b0fe0c4f79dc5d23f8eecb0d0ab4a7c2a348d2dd27edc17ee89bd6
|
Provenance
The following attestation bundles were made for torch_checkpointing-0.1.0.tar.gz:
Publisher:
publish_release.yml on meta-pytorch/torch_checkpointing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_checkpointing-0.1.0.tar.gz -
Subject digest:
304725d78f7c110c521cfdb92357df371a423a0168d38f367cede63c122aea73 - Sigstore transparency entry: 2444452271
- Sigstore integration time:
-
Permalink:
meta-pytorch/torch_checkpointing@3ac7fd9170a9bd879d453a06b1eae9bc41e94273 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/meta-pytorch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_release.yml@3ac7fd9170a9bd879d453a06b1eae9bc41e94273 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file torch_checkpointing-0.1.0-py3-none-any.whl.
File metadata
- Download URL: torch_checkpointing-0.1.0-py3-none-any.whl
- Upload date:
- Size: 121.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a0944c88adcdbe88f4a68870d0d88b5a1c9e421cc5b604c84eda7c17d719164
|
|
| MD5 |
a64082d120a13d65c3559e2ae0e7d7e8
|
|
| BLAKE2b-256 |
ebe1184f1abad2fa8f3090376772a99af4ee552bf939cde979332d203cb7c77e
|
Provenance
The following attestation bundles were made for torch_checkpointing-0.1.0-py3-none-any.whl:
Publisher:
publish_release.yml on meta-pytorch/torch_checkpointing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_checkpointing-0.1.0-py3-none-any.whl -
Subject digest:
1a0944c88adcdbe88f4a68870d0d88b5a1c9e421cc5b604c84eda7c17d719164 - Sigstore transparency entry: 2444452382
- Sigstore integration time:
-
Permalink:
meta-pytorch/torch_checkpointing@3ac7fd9170a9bd879d453a06b1eae9bc41e94273 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/meta-pytorch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_release.yml@3ac7fd9170a9bd879d453a06b1eae9bc41e94273 -
Trigger Event:
workflow_dispatch
-
Statement type: