publish_checkpoint.py in the RL Rollouts repository is a reference publisher. It writes snapshots in the layout that deployments read, and you decide how your training loop calls it.
Prerequisites
- The repository cloned, with the publisher’s Python dependencies installed:
boto3,numpy,safetensors, andzstandard. - Publisher credentials and
ROLLOUT_BUCKETset in your environment. See Configure publisher access in Deploy RL Rollouts. - Checkpoints that meet your model’s checkpoint requirements, such as its quantization layout.
Publish an anchor
To publish a full checkpoint as an anchor: Replace<hf_checkpoint_dir> with your checkpoint’s local directory, then run:
--identity names the snapshot’s directory in your bucket, and --policy-version is the integer label that rollouts report. The publisher uploads every shard, then snapshot_info.json, and prints each file it uploads.
Publish a new anchor occasionally, for example when a chain of deltas gets long or a large share of the weights changed. Loading an anchor takes longer than loading a delta, and serving can slow while it prepares.
Publish a delta
To publish the changes since the previous snapshot: Replace<parent_hf_dir> with the exact weights you published as the previous snapshot, and <new_hf_dir> with the new export, which must have the same tensor names, shapes, and dtypes. Then run:
--previous names the parent snapshot, and --base names the anchor that started the chain. The publisher diffs --parent against --new, so point --parent at the exact bytes you published for the previous snapshot, after quantization, not at your trainer’s master weights.
The publisher encodes the delta with arc_v2 compression and alder32 checksums. Send both formats in the incremental_snapshot_metadata of the hot-load request.
To check a delta without uploading anything, pass --dry-run:
Choose the startup snapshot
STARTUP_SNAPSHOT in your bucket names the snapshot that a new deployment loads first. A replica that no hot-load request has reached also loads it.
To set the startup snapshot:
Rules for published snapshots
- Publish every file before you request a snapshot. The publisher uploads
snapshot_info.jsonlast, and a replica rejects an incomplete snapshot. - Never change a published snapshot. Publish a new identity instead. The publisher refuses an identity that already exists.
- Keep the anchor and every later delta. Replicas that restart rebuild from them. Delete only snapshots from older chains.
Next steps
- Load new weights: Request a published snapshot and check that every replica loaded it.
- Training loops: Publish from Miles or Slime without re-encoding deltas.