Artifacts
All pages
Docs · StartMarkdown

Checkpointing a run

Point a run's checkpoint location at o41://<artifact> instead of s3://bucket/path. Nothing else in the run changes. Checkpoints are written often and read rarely, almost always by the next box of the same run, which is the case Artifacts is built for.

SexpGPU

SexpGPU is our ML framework, the first designed for agents. A run is one experiment file and one binary, and --resume latest is built for spot.

export O41_ARTIFACTS_API_KEY=ak_…
SEXPGPU_CHECKPOINT_DIR=o41://experiments/run-1234 \
  sexpgpu run train.sx --resume latest
FlagEffect
--resume latestResume from the latest checkpoint, or start fresh if there is none. Use it always
noneStart fresh; refused if the artifact already has checkpoints
--resume o41://experiments/run-1234/step-00000300Fork from that checkpoint into a new, empty artifact

The API key is checked before step 1, so a bad key fails at launch, not hours in.

Rust

The o41-checkpoint crate does the same for any Rust program: resume, save, start, fork, load.

Any language

The HTTP API is the contract. Reading the latest checkpoint is one versions/read call and plain GETs:

import os, requests

api = "https://artifacts.041.io/api/v1"
auth = {"Authorization": f"Bearer {os.environ['O41_ARTIFACTS_API_KEY']}"}
v = requests.get(f"{api}/versions/read", headers=auth, params={
    "artifact": "experiments/run-1234", "version": "latest", "urls": "1",
}).json()
for f in v["files"]:
    with open(f["name"], "wb") as out:
        out.write(requests.get(f["url"]).content)

A spot run across clouds

Spot GPUs are cheap because the cloud can take them back. A run that saves often and relaunches with the same command loses only the steps since its last save, and can come back wherever spot capacity is free.

  1. Box A on aws us-east-1 writes step-00000100 … step-00000500 to your S3 bucket in us-east-1, then is preempted.
  2. The job is relaunched on gcp europe-west4. Same command. The client detects its new cloud and region from the VM, or from SKYPILOT_CLUSTER_INFO if you launch with SkyPilot. See placement.
  3. Opening the artifact fences box A, in case it is still alive, and returns step 500 signed and marked cross-cloud. The run reads it once with parallel ranged GETs.
  4. step-00000510 onward lands in your GCS bucket in europe-west4, for free.
  5. Preempted again, the job comes back on azure westeurope, reads step 900 once, and writes to your Blob container there.

A box in a cloud where you have no location still trains: its checkpoints go to that cloud's default location or your fallback, and the run logs a warning. The usage page shows where this happens, which is where a new location pays off.

Cost

Writes are the volume. A 20 GB checkpoint every 30 minutes for a week is 6.7 TB:

Writes go toCost for the week
The box's own region$0
Another region, same cloud≈ $130
Out of the cloud≈ $550–800

A cross-cloud resume of the latest checkpoint costs about $2. Nothing is replicated ahead of time.