vllm.model_executor.model_loader.utils
¶
Utilities for selecting and loading models.
Functions:
-
configure_quant_config–Pass packed_modules_mapping by reference to quant_config so that
-
get_draft_load_config–Get load config for the speculative draft model.
-
initialize_model–Initialize a model with the given configurations.
-
online_quantization_timing_context–Accumulate online quantization processing time for
quant_method. -
process_weights_after_loading–Post-process loaded weights into runtime format.
_MODEL_ARCH_BY_HASH = dict[int, tuple[type[nn.Module], str]]()
module-attribute
¶
Caches the outputs of _get_model_architecture.
configure_quant_config(quant_config, model_class)
¶
Pass packed_modules_mapping by reference to quant_config so that quant_config can properly match fused modules
Note that model attributes are passed by reference to quant_config, enabling them to be updated by model_class.new (ex. chatglm, qwen)
Once the SupportsQuant mixin has been added to all models, this
function can be removed
Source code in vllm/model_executor/model_loader/utils.py
get_draft_load_config(vllm_config)
¶
Get load config for the speculative draft model.
Source code in vllm/model_executor/model_loader/utils.py
initialize_model(vllm_config, *, prefix='', model_class=None, model_config=None)
¶
Initialize a model with the given configurations.
Source code in vllm/model_executor/model_loader/utils.py
online_quantization_timing_context(layer, quant_method)
¶
Accumulate online quantization processing time for quant_method.
Source code in vllm/model_executor/model_loader/utils.py
process_weights_after_loading(model, model_config, target_device)
¶
Post-process loaded weights into runtime format.
Under weights_already_processed (weight cache IPC loader), quant
methods skip tensor transforms and must declare
supports_pre_processed_weights, otherwise this raises RuntimeError.
Source code in vllm/model_executor/model_loader/utils.py
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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |