Skip to content

vllm.config.load

Classes:

  • LoadConfig –

    Configuration for loading the model weights.

LoadConfig

Configuration for loading the model weights.

Methods:

Attributes:

device = None class-attribute instance-attribute

Device to which model weights will be loaded, default to device_config.device

download_dir = None class-attribute instance-attribute

Directory to download and load the weights, default to the default cache directory of Hugging Face.

ignore_patterns = Field(default_factory=lambda: ['original/**/*']) class-attribute instance-attribute

The list of patterns to ignore when loading the model. Default to "original/*/" to avoid repeated loading of llama's checkpoints.

load_format = 'auto' class-attribute instance-attribute

The format of the model weights to load.

  • "auto" will try to load the weights in the safetensors format and fall back to the pytorch bin format if safetensors format is not available.
  • "pt" will load the weights in the pytorch bin format.
  • "safetensors" will load the weights in the safetensors format.
  • "instanttensor" will load the Safetensors weights on CUDA devices using InstantTensor, which enables distributed loading with pipelined prefetching and fast direct I/O.
  • "ipc_cache" will map post-quantized weights from a local weight cache daemon via CUDA IPC for fast engine restarts. Launch the daemon with vllm preload first.
  • "npcache" will load the weights in pytorch format and store a numpy cache to speed up the loading.
  • "dummy" will initialize the weights with random values, which is mainly for profiling.
  • "tensorizer" will use CoreWeave's tensorizer library for fast weight loading. See the Tensorize vLLM Model script in the Examples section for more information.
  • "runai_streamer" will load the Safetensors weights using Run:ai Model Streamer.
  • "runai_streamer_sharded" will load weights from pre-sharded checkpoint files using Run:ai Model Streamer.
  • "sharded_state" will load weights from pre-sharded checkpoint files, supporting efficient loading of tensor-parallel models.
  • "mistral" will load weights from consolidated safetensors files used by Mistral models.
  • "modelexpress" will load weights using ModelExpress.
  • Other custom values can be supported via plugins.

model_loader_extra_config = Field(default_factory=dict) class-attribute instance-attribute

Extra config for model loader. This will be passed to the model loader corresponding to the chosen load_format.

pt_load_map_location = 'cpu' class-attribute instance-attribute

The map location for loading pytorch checkpoint, to support loading checkpoints can only be loaded on certain devices like "cuda", this is equivalent to {"": "cuda"}. Another supported format is mapping from different devices like from GPU 1 to GPU 0: {"cuda:1": "cuda:0"}. Note that when passed from command line, the strings in dictionary need to be double quoted for json parsing. For more details, see the original doc for map_location parameter in torch.load parameter.

safetensors_load_strategy = None class-attribute instance-attribute

Specifies the loading strategy for safetensors weights.

  • None (default): Uses memory-mapped (lazy) loading. When an NFS filesystem is detected and the total checkpoint size fits within 90% of available RAM, prefetching is enabled automatically.
  • "lazy": Weights are memory-mapped from the file. This enables on-demand loading and is highly efficient for models on local storage. Unlike the default (None), auto-prefetch on NFS is not performed.
  • "eager": The entire file is read into CPU memory upfront before loading. This is recommended for models on network filesystems (e.g., Lustre, NFS) as it avoids inefficient random reads, significantly speeding up model initialization. However, it uses more CPU RAM.
  • "prefetch": Checkpoint files are read into the OS page cache before workers load them, speeding up the model loading phase. Useful on network or high-latency storage.
  • "torchao": Weights are loaded in upfront and then reconstructed into torchao tensor subclasses. This is used when the checkpoint was quantized using torchao and saved using safetensors. Needs torchao >= 0.14.0.

safetensors_prefetch_block_size = Field(default=DEFAULT_SAFETENSORS_PREFETCH_BLOCK_SIZE, ge=1) class-attribute instance-attribute

Read size in bytes for each safetensors checkpoint file prefetch.

safetensors_prefetch_num_threads = Field(default=DEFAULT_SAFETENSORS_PREFETCH_NUM_THREADS, ge=1) class-attribute instance-attribute

Number of worker threads used to prefetch safetensors checkpoint files into the OS page cache when safetensors prefetching is enabled.

shuffle_safetensors_files = False class-attribute instance-attribute

Whether to shuffle the safetensors checkpoint files during loading. When enabled, files are randomly shuffled based on the distributed rank, which can help with load balancing and improve weight loading speed in startup scenarios. This reduces I/O contention by ensuring different ranks load different files in a randomized order. Set to True to enable shuffling. Default is False.

use_tqdm_on_load = True class-attribute instance-attribute

Whether to enable tqdm for showing progress bar when loading model weights.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.