Skip to main content

torch_checkpointing

High-performance asynchronous checkpointing for PyTorch. It takes checkpoint saving off your training loop's critical path:

  • Zero-overhead savessave() 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 CheckpointManager drives 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 CheckpointManager for 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 / StorageConfig interface; 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, and resharder via ItemSpec.
  • 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 / StorageConfig interface 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

torch_checkpointing-0.1.0.tar.gz (181.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch_checkpointing-0.1.0-py3-none-any.whl (121.3 kB view details)

Uploaded Python 3

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

Hashes for torch_checkpointing-0.1.0.tar.gz
Algorithm Hash digest
SHA256 304725d78f7c110c521cfdb92357df371a423a0168d38f367cede63c122aea73
MD5 d20861ab0236e330d25d7fe324210e0e
BLAKE2b-256 85f7c16752b0fe0c4f79dc5d23f8eecb0d0ab4a7c2a348d2dd27edc17ee89bd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for torch_checkpointing-0.1.0.tar.gz:

Publisher: publish_release.yml on meta-pytorch/torch_checkpointing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torch_checkpointing-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for torch_checkpointing-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a0944c88adcdbe88f4a68870d0d88b5a1c9e421cc5b604c84eda7c17d719164
MD5 a64082d120a13d65c3559e2ae0e7d7e8
BLAKE2b-256 ebe1184f1abad2fa8f3090376772a99af4ee552bf939cde979332d203cb7c77e

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page