vllm.model_executor.model_loader.reload.direct
¶
Direct weight reload (VLLM_RELOAD_MODE=direct, or auto where it applies).
Cold start records each tensor's checkpoint layout before post-load processing
(PWAL). begin views re-laid-out tensors back to that layout on their
storage, the loaders write the checkpoint in place, and finish reruns PWAL,
which must keep addresses (captured CUDA graphs) and refill derived tensors.
Between begin and a successful finish the model must not run; there is
no rollback, the next full update repairs it.
Delivery contract: an update loads every parameter cold start loaded (as
model.load_weights reports it; after a dummy start, the first update sets
the record and is not checked itself), except those level 2 sleep preserves
(--sleep-preserve-parameter-names: the update does not rewrite them).
finish checks it before rerunning PWAL, which would otherwise reprocess the
kept runtime bytes of a parameter the update left out.
A parameter flagged fill_on_reload must also be delivered whole: begin
zero-fills each such tensor this model owns whole, as its checkpoint-layout
view (padding the loaders skip or fill, and a load plan skips loader fills);
a tensor shared with another model (draft and target) is zeroed only by its
owner's begin.
Functions:
-
begin_direct_reload–Make every tensor writable by its checkpoint weight loader.
-
direct_reload_active–Whether
modelis betweenbegin_direct_reloadand its finish. -
direct_reload_enabled–Whether a model loaded now records its checkpoint layout to reload directly.
-
direct_reload_refusal–Why direct weight reload cannot update
config's model, if it cannot. -
finish_direct_reload–Rerun cold-start post-load processing.
-
loadable_tensors–Parameters and persistent buffers, each object once.
-
mark_loaded–Report parameter
nameloaded withoutload_weights(written in -
record_checkpoint_layout–Cold start, before post-load processing: remember each tensor's
-
reloads_directly–Whether
model's updates reload directly: its cold start recorded a layout. -
track_loaded_params–Collect the parameter names
model.load_weightsreturns until the
_check_params_kept(model)
¶
Raise if post-load processing registered a new parameter under a
checkpoint name: begin cannot view it back, and the loader would write
checkpoint bytes into its runtime layout.
_check_update_complete(model, model_config)
¶
Raise unless the update loaded every parameter cold start loaded, except
those level 2 sleep preserves because the update does not rewrite them.
load_weights reports parameter names, whatever checkpoint names fed
them (fused or per-expert); a tied parameter counts under either name.
_checkpoint_views(model)
¶
(tensor, view of its storage in its checkpoint layout) for every tensor post-load processing re-laid out; raises if a storage cannot hold its checkpoint layout.
_module_refusal(model)
¶
Why the model's modules cannot reload directly, if they cannot.
begin_direct_reload(model)
¶
Make every tensor writable by its checkpoint weight loader.
Everything that can refuse the reload is checked first and raises with the model untouched. Once this returns, the model holds checkpoint-layout bytes until a finish succeeds.
direct_reload_active(model)
¶
Whether model is between begin_direct_reload and its finish.
direct_reload_enabled()
¶
Whether a model loaded now records its checkpoint layout to reload directly.
direct_reload_refusal(config)
¶
Why direct weight reload cannot update config's model, if it cannot.
finish_direct_reload(model, model_config, device)
¶
Rerun cold-start post-load processing.
loadable_tensors(model)
¶
Parameters and persistent buffers, each object once.
mark_loaded(model, name)
¶
Report parameter name loaded without load_weights (written in
place by a weight transfer engine).
record_checkpoint_layout(model)
¶
Cold start, before post-load processing: remember each tensor's checkpoint layout and loader metadata, which tensors this model owns (those no other model recorded first), and which parameter names hold checkpoint tensors. Runs once; reloads reuse the cold-start record.
reloads_directly(model)
¶
Whether model's updates reload directly: its cold start recorded a layout.
track_loaded_params(model)
¶
Collect the parameter names model.load_weights returns until the
cold-start record or the reload's finish; None once a call returns
None (the model does not report them: nothing is checked).