Milestone 5 — Weight-provisioning job ✅
Goal: pull model weights into a Modal Volume, pinned to an exact revision, idempotently, with a real integrity check. Code: ~/modal_examples/milestones/m5_provision_weights.py.
What was built
A Modal function that snapshot_downloads the weights into the boson-weights-demo Volume at a pinned commit SHA, writes a sentinel, and commit()s. A verify() function independently checks the result. Idempotency: a re-run skips only if the sentinel matches AND the weights are actually present & intact (≥1 MB + a real .safetensors/.bin), so a corrupt/partial Volume re-provisions instead of falsely skipping.
Stand-in model SmolLM2-135M is used here; the control flow (pin → download → commit → intact-check) is identical for the real closed-source weights. The real gated model additionally needs an HF/store token via
modal.Secret.
How it was validated (ran on Modal)
FIRST RUN: download -> 51 files, 1969.8 MB, committed
SECOND RUN: skip (present & intact)
VERIFY: provisioned=True, revision_pinned=True, has_weights=True, has_config=True, 1.97 GB
VALIDATION PASSED: provisioned, pinned, idempotent (files+bytes stable), weights+config present.
Pinned to the real SHA 12fd25f77366fa6b3b4b768ec3050bf629380bac (fetched from the HF API — an earlier fabricated SHA was caught and replaced).
Code review (separate subagent) — CHANGES NEEDED → fixed
| Finding | Fix applied |
|---|---|
verify only checked a self-written sentinel (tautological) |
Skip now requires weights present + intact (size + real weight file), not just the sentinel |
endswith("config.json") over-matched generation_config.json |
Exact basename match == "config.json" |
main() asserts proved plumbing, not substance |
Added byte-floor assert + r1.files==r2.files and r1.bytes==r2.bytes idempotency-equality assert |
| Real gated/FP8 model needs auth | Documented: provisioning job needs an HF/store token modal.Secret |
Re-ran after fixes → still green.
Status: ✅ validated (stand-in model; real gated weights need a token Secret).