vllm.model_executor.model_loader.default_loader
¶
Classes:
-
DefaultModelLoader–Model loader that can load different file types from disk.
DefaultModelLoader
¶
Bases: BaseModelLoader
Model loader that can load different file types from disk.
Classes:
-
Source–A source for weights.
Source
dataclass
¶
A source for weights.
Attributes:
-
allow_patterns_overrides(list[str] | None) –If defined, weights will load exclusively using these patterns.
-
fall_back_to_pt(bool) –Whether .pt weights can be used.
-
is_unused_weight(Callable[[str], bool] | None) –If defined, safetensors shards holding only weights whose checkpoint
-
model_or_path(str) –The model ID or path.
-
prefix(str) –A prefix to prepend to all weights.
-
revision(str | None) –The optional model revision.
-
subfolder(str | None) –The subfolder inside the model repo.
allow_patterns_overrides = None
class-attribute
instance-attribute
¶
If defined, weights will load exclusively using these patterns.
fall_back_to_pt = True
class-attribute
instance-attribute
¶
Whether .pt weights can be used.
is_unused_weight = None
class-attribute
instance-attribute
¶
If defined, safetensors shards holding only weights whose checkpoint name (before prefix) it accepts are not read.
model_or_path
instance-attribute
¶
The model ID or path.
prefix = ''
class-attribute
instance-attribute
¶
A prefix to prepend to all weights.
revision
instance-attribute
¶
The optional model revision.
subfolder = None
class-attribute
instance-attribute
¶
The subfolder inside the model repo.
_get_weights_iterator(source)
¶
Get an iterator for the model weights based on the load format.
_init_ep_weight_filter(model, model_config)
¶
Compute local expert ids for EP weight filtering.
When expert parallelism is active, each rank only needs a subset of expert weights. By computing the set upfront we can skip non-local expert tensors before reading them from disk.
_init_mm_encoder_only_weight_filter(model, model_config)
¶
Skip pure language-model safetensors shards under --mm-encoder-only.
_prepare_weights(model_name_or_path, subfolder, revision, fall_back_to_pt, allow_patterns_overrides)
¶
Prepare weights for the model.
If the model is not local, it will be downloaded.