Skip to content

Implicit checkpointing! #6

Draft
jefferynidd wants to merge 21 commits intomasterfrom
jefferyn/implicit-cps-v1
Draft

Implicit checkpointing! #6
jefferynidd wants to merge 21 commits intomasterfrom
jefferyn/implicit-cps-v1

Conversation

@jefferynidd
Copy link
Copy Markdown

WIP: need to clean this up quite a bit, but here's a tl;dr

Implicit checkpointing: automatically save and restore flow attributes across retries

This branch adds implicit checkpointing to the @checkpoint decorator — instead of requiring users to manage files manually, current.checkpoint.save() now automatically serializes the flow step's Python attributes to durable storage, and current.checkpoint.load() restores them in place. The result is that crash-safe training loops require almost no boilerplate.

What changed

  • save() and load() no longer take a path — they operate directly on the flow's attributes. save() snapshots whichever fields are in scope; load() writes them back onto self. An include= or exclude= list on the decorator controls which fields are included.

  • Added current.checkpoint.inspect() — returns the saved field manifest (name → type) without downloading the checkpoint, useful for introspecting what was saved.

  • current.checkpoint.list() now returns CheckpointArtifact objects instead of raw dicts, giving callers typed access to checkpoint metadata.

  • Fixed a bug in list(attempt=N) where passing an explicit attempt number caused an AttributeError (Task object being passed back into the Task() constructor).

  • Card: checkpoints now sorted by creation time in the live-refresh table.

  • Card: lineage section fixed — previously showed an empty table when the loaded checkpoint had no ancestors; now shows _no lineage found_ instead. Also added an "Attempt" column and fixed the ordering so index 0 is always the oldest ancestor.

  • Card: lineage chain now includes the directly loaded checkpoint — previously the loaded checkpoint itself was omitted from the lineage table, making the second attempt always appear to have no lineage.

  • New example flow (flows/example_pytorch_training.py) demonstrating the full pattern end-to-end with a simulated PyTorch training loop that deliberately fails mid-epoch and resumes cleanly on retry.

jefferynidd and others added 21 commits March 6, 2026 11:20
- Remove disable_card feature from CheckpointDecorator
- Fix _extract_task_object bug where Task object was passed back into
  Task() constructor when attempt was specified, causing AttributeError
- Update inspect_checkpoints to iterate over all attempts (0..current_attempt)
  using Task.current_attempt to get the range

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant