Conversation
Every caller that streams checkpoint-format weights into a live model (NCCL, IPC and sharded-RDT engines, GPUModelRunner.reload_weights, the torchao decorator) named the mechanism directly: initialize_layerwise_reload / finalize_layerwise_reload. Expose start_reload / finish_reload / abort_reload from model_loader.reload and route all of them through it, so the mechanism behind a reload is chosen in one place. abort_reload is new: it undoes start_reload for every layer still waiting for weights (kernel tensors and original loaders put back, buffered weights dropped), leaving already-completed layers on their new weights. The sharded RDT engine's dry-run bake had its own copy of this; it now calls abort_reload and keeps only its stamp unwrapping. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Ao Shen <aoshen524@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every caller that streams checkpoint-format weights into a live model names the mechanism directly —
initialize_layerwise_reload/finalize_layerwise_reload— in five places: the NCCL, IPC and sharded-RDT weight-transfer engines,GPUModelRunner.reload_weights, and the torchao decorator. The RDT engine additionally reaches into layerwise internals for its dry-run bake and carried its own private "put the model back" routine, and its docstring asked for exactly this: "a public API should expose first-class ... anabort_layerwise_reloadinstead of_restore_after_dry_run."RFC vllm-project#54477 (selective weight reload) needs to choose the reload mechanism in one place. With this PR that place exists.
What
model_loader/reload/lifecycle.py:start_reload(model),finish_reload(model, model_config),abort_reload(model)— re-exported frommodel_loader.reload. Today they forward to the layerwise implementation; the old names stay exported.abort_reloadis new: undoesstart_reloadfor every layer still waiting for weights — kernel tensors put back,online_process_loaderwrappers removed, buffered weights dropped, torchao flag restored — so the model is loadable again. It is deliberately not a rollback: layers that completed keep their new weights, and tensors loaded in place (SKIP_TENSORS, e.g.bias) keep what was written. That matches the failure semantics in RFC [RFC]: Selective Weight Reload for RL Training vllm-project/vllm#54477 §11 (a failed update is terminal; recovery is a fresh reload or restart), and rollback would require the shadow copy the RFC is removing._bakenow callsabort_reloadand keeps only its own stamp unwrapping (_unwrap_recording_stamps);_restore_after_dry_runis deleted. Abort only touchesonline_process_loaderwrappers, so RDT's stamps and loader identities are preserved exactly as before.docs/training/layerwise.mdexample uses the public API withfinish_reloadinside the protected block;docs/training/weight_transfer/base.mdengine template updated.Not a duplicate
vllm-project#49201 (closed, conflicts) proposed a full
WeightLoadSessionobject. This is the minimal slice of that idea — three functions, no session state — sized to be mergeable and sufficient for the RFC.Tests
New test
test_abort_reload_restores_pending_layers: a completed layer keeps new weights, a pending layer gets its original tensors/loaders back withweightuntouched and in-placebiaskept as written, and a subsequentstart_reload→finish_reloadon the same model succeeds with original tensor identity.Audit
Reviewed by Codex (gpt-6-astra), two rounds. Round 1 caught: the new file missing from the commit,
abortattaching a loader attribute to tensors that never had one (now only realonline_process_loaderwrappers are unwrapped), andfinish_reloadoutside thetryin the docs example. Round 2: PASS (independent CPU probes for RDT-cleanup equivalence, nested wrappers, first-load, state restoration).AI assistance (Claude Code + Codex) was used; every line reviewed and tests run by the submitter.
🤖 Generated with Claude Code