vllm.model_executor.model_loader.reload.trace
¶
Tracing a model's weight loaders on zero-storage checkpoint tensors.
A TraceTensor stands in for one checkpoint tensor while load_weights
runs. View ops (VIEW_OPS) return a child that knows, as a meta view over
the checkpoint tensor, where each of its elements sits in that tensor.
What a trace cannot settle by itself (copy_ from it, ops outside
VIEW_OPS, value reads) it hands to the bake's _PlanSink (bake.py),
which decides what each means for the plan; nothing moves data.
Classes:
-
TraceTensor–Zero-storage meta tensor that records how a loader slices a checkpoint
TraceTensor
¶
Bases: Tensor
Zero-storage meta tensor that records how a loader slices a checkpoint tensor.
_geom is a meta view over a contiguous meta tensor of the checkpoint
shape: its offset and strides say which checkpoint element each element of
this tensor is. It is None (and _lost says why) once this tensor
is no longer a view of the checkpoint tensor. _sink is the bake that
owns the trace.
Methods:
-
checkpoint–The whole checkpoint tensor
name.
Source code in vllm/model_executor/model_loader/reload/trace.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
_is_noop_to(args, kwargs)
¶
.to() that keeps the dtype, such as .to(param.device): a
device move keeps every byte, and a trace has no device to move
from.
Source code in vllm/model_executor/model_loader/reload/trace.py
_view(func, args, kwargs)
¶
Run the view op on _geom for the children's shapes and
geometry; on a plain meta tensor when that is lost or fails.
Source code in vllm/model_executor/model_loader/reload/trace.py
checkpoint(name, shape, dtype, sink)
classmethod
¶
The whole checkpoint tensor name.