vllm.config ¶
Modules:
Name | Description |
---|---|
cache | |
compilation | |
device | |
kv_events | |
kv_transfer | |
load | |
lora | |
model | |
multimodal | |
observability | |
parallel | |
pooler | |
scheduler | |
speculative | |
speech_to_text | |
structured_outputs | |
utils | Utility functions for vLLM config dataclasses. |
vllm | |
CacheDType module-attribute
¶
CacheDType = Literal[
"auto",
"bfloat16",
"fp8",
"fp8_e4m3",
"fp8_e5m2",
"fp8_inc",
]
DistributedExecutorBackend module-attribute
¶
DistributedExecutorBackend = Literal[
"ray", "mp", "uni", "external_launcher"
]
HfOverrides module-attribute
¶
LogprobsMode module-attribute
¶
LogprobsMode = Literal[
"raw_logits",
"raw_logprobs",
"processed_logits",
"processed_logprobs",
]
ModelDType module-attribute
¶
ModelDType = Literal[
"auto",
"half",
"float16",
"bfloat16",
"float",
"float32",
]
TaskOption module-attribute
¶
TaskOption = Literal[
"auto",
"generate",
"embedding",
"embed",
"classify",
"score",
"reward",
"transcription",
"draft",
]
__all__ module-attribute
¶
__all__ = [
"BlockSize",
"CacheConfig",
"CacheDType",
"MambaDType",
"PrefixCachingHashAlgo",
"CompilationConfig",
"CompilationLevel",
"CUDAGraphMode",
"PassConfig",
"Device",
"DeviceConfig",
"KVEventsConfig",
"KVTransferConfig",
"LoadConfig",
"LoRAConfig",
"ConvertOption",
"HfOverrides",
"LogprobsMode",
"ModelConfig",
"ModelDType",
"ModelImpl",
"RunnerOption",
"TaskOption",
"TokenizerMode",
"iter_architecture_defaults",
"try_match_architecture_defaults",
"MMCacheType",
"MMEncoderTPMode",
"MultiModalConfig",
"DetailedTraceModules",
"ObservabilityConfig",
"DistributedExecutorBackend",
"EPLBConfig",
"ParallelConfig",
"PoolerConfig",
"RunnerType",
"SchedulerConfig",
"SchedulerPolicy",
"SpeculativeConfig",
"SpeechToTextConfig",
"StructuredOutputsConfig",
"ConfigType",
"SupportsMetricsInfo",
"config",
"get_attr_docs",
"is_init_field",
"update_config",
"VllmConfig",
"get_cached_compilation_config",
"get_current_vllm_config",
"set_current_vllm_config",
"get_layers_from_vllm_config",
]
CUDAGraphMode ¶
Bases: Enum
Constants for the cudagraph mode in CompilationConfig. Meanwhile, the subset enum NONE
, PIECEWISE
and FULL
are also treated as concrete runtime mode for cudagraph runtime dispatching.
Source code in vllm/config/compilation.py
decode_mode ¶
decode_mode() -> CUDAGraphMode
max_cudagraph_mode ¶
max_cudagraph_mode() -> CUDAGraphMode
mixed_mode ¶
mixed_mode() -> CUDAGraphMode
CacheConfig ¶
Configuration for the KV cache.
Source code in vllm/config/cache.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 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 210 211 212 213 214 215 216 217 218 219 220 |
|
block_size class-attribute
instance-attribute
¶
block_size: SkipValidation[BlockSize] = None
Size of a contiguous cache block in number of tokens. On CUDA devices, only block sizes up to 32 are supported.
This config has no static default. If left unspecified by the user, it will be set in Platform.check_and_update_config()
based on the current platform.
cache_dtype class-attribute
instance-attribute
¶
cache_dtype: CacheDType = 'auto'
Data type for kv cache storage. If "auto", will use model data type. CUDA 11.8+ supports fp8 (=fp8_e4m3) and fp8_e5m2. ROCm (AMD GPU) supports fp8 (=fp8_e4m3). Intel Gaudi (HPU) supports fp8 (using fp8_inc). Some models (namely DeepSeekV3.2) default to fp8, set to bfloat16 to use bfloat16 instead, this is an invalid option for models that do not default to fp8.
calculate_kv_scales class-attribute
instance-attribute
¶
calculate_kv_scales: bool = False
This enables dynamic calculation of k_scale
and v_scale
when kv_cache_dtype is fp8. If False
, the scales will be loaded from the model checkpoint if available. Otherwise, the scales will default to 1.0.
cpu_kvcache_space_bytes class-attribute
instance-attribute
¶
(CPU backend only) CPU key-value cache space.
cpu_offload_gb class-attribute
instance-attribute
¶
cpu_offload_gb: float = 0
The space in GiB to offload to CPU, per GPU. Default is 0, which means no offloading. Intuitively, this argument can be seen as a virtual way to increase the GPU memory size. For example, if you have one 24 GB GPU and set this to 10, virtually you can think of it as a 34 GB GPU. Then you can load a 13B model with BF16 weight, which requires at least 26GB GPU memory. Note that this requires fast CPU-GPU interconnect, as part of the model is loaded from CPU memory to GPU memory on the fly in each model forward pass.
enable_prefix_caching class-attribute
instance-attribute
¶
Whether to enable prefix caching. Enabled by default for V1.
gpu_memory_utilization class-attribute
instance-attribute
¶
gpu_memory_utilization: float = 0.9
The fraction of GPU memory to be used for the model executor, which can range from 0 to 1. For example, a value of 0.5 would imply 50% GPU memory utilization. If unspecified, will use the default value of 0.9. This is a per-instance limit, and only applies to the current vLLM instance. It does not matter if you have another vLLM instance running on the same GPU. For example, if you have two vLLM instances running on the same GPU, you can set the GPU memory utilization to 0.5 for each instance.
is_attention_free class-attribute
instance-attribute
¶
is_attention_free: bool = False
Whether the model is attention-free. This is primarily set in ModelConfig
and that value should be manually duplicated here.
kv_cache_memory_bytes class-attribute
instance-attribute
¶
Size of KV Cache per GPU in bytes. By default, this is set to None and vllm can automatically infer the kv cache size based on gpu_memory_utilization. However, users may want to manually specify the kv cache memory size. kv_cache_memory_bytes allows more fine-grain control of how much memory gets used when compared with using gpu_memory_memory_utilization. Note that kv_cache_memory_bytes (when not-None) ignores gpu_memory_utilization
kv_sharing_fast_prefill class-attribute
instance-attribute
¶
kv_sharing_fast_prefill: bool = False
This feature is work in progress and no prefill optimization takes place with this flag enabled currently.
In some KV sharing setups, e.g. YOCO (https://arxiv.org/abs/2405.05254), some layers can skip tokens corresponding to prefill. This flag enables attention metadata for eligible layers to be overridden with metadata necessary for implementing this optimization in some models (e.g. Gemma3n)
mamba_cache_dtype class-attribute
instance-attribute
¶
mamba_cache_dtype: MambaDType = 'auto'
The data type to use for the Mamba cache (both the conv as well as the ssm state). If set to 'auto', the data type will be inferred from the model config.
mamba_page_size_padded class-attribute
instance-attribute
¶
Optional override for mamba page size; used by hybrid mamba/attention models to ensure exact alignment with attention page size.
mamba_ssm_cache_dtype class-attribute
instance-attribute
¶
mamba_ssm_cache_dtype: MambaDType = 'auto'
The data type to use for the Mamba cache (ssm state only, conv state will still be controlled by mamba_cache_dtype). If set to 'auto', the data type for the ssm state will be determined by mamba_cache_dtype.
num_cpu_blocks class-attribute
instance-attribute
¶
The number of blocks to allocate for CPU memory.
num_gpu_blocks class-attribute
instance-attribute
¶
The number of blocks to allocate for GPU memory.
num_gpu_blocks_override class-attribute
instance-attribute
¶
Number of GPU blocks to use. This overrides the profiled num_gpu_blocks
if specified. Does nothing if None
. Used for testing preemption.
prefix_caching_hash_algo class-attribute
instance-attribute
¶
prefix_caching_hash_algo: PrefixCachingHashAlgo = 'sha256'
Set the hash algorithm for prefix caching:
-
"sha256" uses Pickle for object serialization before hashing.
-
"sha256_cbor" provides a reproducible, cross-language compatible hash. It serializes objects using canonical CBOR and hashes them with SHA-256.
sliding_window class-attribute
instance-attribute
¶
Sliding window size for the KV cache. This is primarily set in ModelConfig
and that value should be manually duplicated here.
swap_space class-attribute
instance-attribute
¶
swap_space: float = 4
Size of the CPU swap space per GPU (in GiB).
__post_init__ ¶
_verify_args ¶
_verify_args() -> Self
Source code in vllm/config/cache.py
_verify_cache_dtype ¶
Source code in vllm/config/cache.py
_verify_prefix_caching ¶
Source code in vllm/config/cache.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/cache.py
metrics_info ¶
verify_with_parallel_config ¶
verify_with_parallel_config(
parallel_config: ParallelConfig,
) -> None
Source code in vllm/config/cache.py
CompilationConfig ¶
Configuration for compilation. It has three parts:
- Top-level Compilation control:
- CudaGraph capture:
- Inductor compilation:
use_inductor
compile_sizes
inductor_compile_config
inductor_passes
- custom inductor passes
Why we have different sizes for cudagraph and inductor: - cudagraph: a cudagraph captured for a specific size can only be used for the same size. We need to capture all the sizes we want to use. - inductor: a graph compiled by inductor for a general shape can be used for different sizes. Inductor can also compile for specific sizes, where it can have more information to optimize the graph with fully static shapes. However, we find the general shape compilation is sufficient for most cases. It might be beneficial to compile for certain small batchsizes, where inductor is good at optimizing.
Source code in vllm/config/compilation.py
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 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
|
_attention_ops class-attribute
¶
_attention_ops: list[str] = [
"vllm.unified_attention",
"vllm.unified_attention_with_output",
"vllm.mamba_mixer2",
"vllm.mamba_mixer",
"vllm.short_conv",
"vllm.linear_attention",
"vllm.plamo2_mamba_mixer",
"vllm.gdn_attention",
"vllm.sparse_attn_indexer",
]
backend class-attribute
instance-attribute
¶
backend: str = ''
The backend for compilation. It needs to be a string:
- "" (empty string): use the default backend.
- "eager"/"openxla"/...: use the specified backend registered in PyTorch.
- "full.module.name": a qualified name which can be used to import the
backend function. We use string to avoid serialization issues when using compilation in a distributed setting. When the compilation level is 1 or 2, the backend is used for the compilation directly (it sees the whole graph). When the compilation level is 3, the backend is used for the piecewise compilation (it sees a part of the graph).
bs_to_padded_graph_size class-attribute
instance-attribute
¶
optimization: Intuitively, bs_to_padded_graph_size should be dict[int, int]. since we know all keys are in a range [0, max_capture_size], we can optimize it to list[int] for better lookup performance.
cache_dir class-attribute
instance-attribute
¶
cache_dir: str = ''
The directory to store the compiled graph, to accelerate Inductor compilation. By default, it will use model-related information to generate a cache directory.
compilation_time class-attribute
instance-attribute
¶
time taken for compilation
compile_sizes class-attribute
instance-attribute
¶
Sizes to compile for inductor. In addition to integers, it also supports "cudagraph_capture_sizes" to specify the sizes for cudagraph capture.
cudagraph_capture_sizes class-attribute
instance-attribute
¶
Sizes to capture cudagraph. - None (default): capture sizes are inferred from vllm config. - list[int]: capture sizes are specified as given.
cudagraph_copy_inputs class-attribute
instance-attribute
¶
cudagraph_copy_inputs: bool = False
Whether to copy input tensors for cudagraph. If the caller can guarantee that the same input buffers are always used, it can set this to False. Otherwise, it should set this to True, and the compiler will copy the input to an internally managed buffer. Default is False. Note that this flag is only effective when cudagraph_mode is PIECEWISE.
cudagraph_mode class-attribute
instance-attribute
¶
cudagraph_mode: Optional[CUDAGraphMode] = None
The mode of the cudagraph:
- NONE, no cudagraph capture.
- PIECEWISE.
- FULL.
- FULL_DECODE_ONLY.
- FULL_AND_PIECEWISE. (v1 default)
PIECEWISE mode build piecewise cudagraph only, keeping the cudagraph incompatible ops (i.e. some attention ops) outside the cudagraph for general flexibility.
FULL mode: Capture full cudagraph for all batches. Can be good for small models or workloads with small prompts; not supported by many backends. Generally for performance FULL_AND_PIECEWISE is better.
FULL_DECODE_ONLY mode: Capture full cudagraph for decode batches only. Mixed prefill-decode batches are run without cudagraphs. Can be good for decode instances in a P/D setup where prefill is not as important so we can save some memory.
FULL_AND_PIECEWISE mode: Capture full cudagraph for decode batches and piecewise cudagraph for prefill and mixed prefill-decode batches. This is the most performant mode for most models and is the default.
Currently, the cudagraph mode is only used for the v1 engine. Note that the cudagraph logic is generally orthogonal to the compilation logic. While piecewise cudagraphs require piecewise compilation (level=PIECEWISE and non-empty splitting_ops), full cudagraphs are supported with and without compilation.
Warning: This flag is new and subject to change in addition more modes may be added.
cudagraph_num_of_warmups class-attribute
instance-attribute
¶
cudagraph_num_of_warmups: int = 0
Number of warmup runs for cudagraph. It means the first several runs will be treated as warmup runs. Only after that, the execution will be recorded, and the recorded cudagraph will be used for subsequent runs.
custom_ops class-attribute
instance-attribute
¶
Fine-grained control over which custom ops to enable/disable. Use 'all' to enable all, 'none' to disable all. Also specify a list of custom op names to enable (prefixed with a '+'), or disable (prefixed with a '-'). Examples:
- 'all,-op1' to enable all except op1
- 'none,+op1,+op2' to enable only op1 and op2
By default, all custom ops are enabled when running without Inductor and disabled when running with Inductor: level>=PIECEWISE and use_inductor=True. Inductor generates (fused) Triton kernels for disabled custom ops.
debug_dump_path class-attribute
instance-attribute
¶
The path to dump the debug information.
disabled_custom_ops class-attribute
instance-attribute
¶
custom ops that are disabled
enabled_custom_ops class-attribute
instance-attribute
¶
custom ops that are enabled
full_cuda_graph class-attribute
instance-attribute
¶
whether to use a full cuda graph for the entire forward pass rather than splitting certain operations such as attention into subgraphs. Thus this flag cannot be used together with splitting_ops. This may provide performance benefits for smaller models. Warning: This flag is deprecated and will be removed in the next major or minor release, i.e. v0.11.0 or v1.0.0. Please use cudagraph_mode= FULL_AND_PIECEWISE instead.
inductor_compile_config class-attribute
instance-attribute
¶
Additional configurations for inductor. - None: use default configurations.
inductor_passes class-attribute
instance-attribute
¶
Additional passes for inductor. It is a dictionary from pass name to pass function qualified name. We use function name because the config uses JSON format. If we pass the config from Python, functions can also be passed directly via Python object constructor, e.g. CompilationConfig(inductor_passes={"a": func})
.
level class-attribute
instance-attribute
¶
The level of compilation:
- None: If None, we will select the default compilation level. For V1 engine this is 3, for V0 engine this is 0.
- 0: no compilation.
- 1: dynamo as is.
- 2: dynamo once.
- 3: piecewise compilation.
local_cache_dir class-attribute
instance-attribute
¶
local cache dir for each rank
max_capture_size class-attribute
instance-attribute
¶
not configurable, computed after init
pass_config class-attribute
instance-attribute
¶
pass_config: PassConfig = field(default_factory=PassConfig)
Custom inductor passes, see PassConfig for more details
splitting_ops class-attribute
instance-attribute
¶
A list of ops to split the full graph into subgraphs, used in piecewise compilation.
static_forward_context class-attribute
instance-attribute
¶
Per-model forward context Map from layer name to layer objects that need to be accessed outside model code, e.g., Attention, FusedMOE when dp_size>1.
traced_files class-attribute
instance-attribute
¶
files that are traced for compilation
use_cudagraph class-attribute
instance-attribute
¶
use_cudagraph: bool = True
Whether to use cudagraph inside compilation. - False: cudagraph inside compilation is not used. - True: cudagraph inside compilation is used. It requires that all input buffers have fixed addresses, and all splitting ops write their outputs to input buffers. In the vLLM V1 Engine, this flag only applies for CompilationLevel.PIECEWISE (aka -O3). Note that this is orthogonal to the cudagraph capture logic outside of compilation. Warning: This flag is deprecated and will be removed in the next major or minor release, i.e. v0.11.0 or v1.0.0. Please use cudagraph_mode=PIECEWISE instead.
use_inductor class-attribute
instance-attribute
¶
use_inductor: bool = True
Whether to use inductor compilation:
- False: inductor compilation is not used. graph runs in eager (custom_ops enabled by default).
- True: inductor compilation is used (custom_ops disabled by default). One graph for symbolic shape and one graph per size in compile_sizes are compiled using configurations in inductor_compile_config.
This setting is ignored if level<PIECEWISE.
use_inductor_graph_partition class-attribute
instance-attribute
¶
use_inductor_graph_partition: bool = False
Use inductor graph partition to split the graph at cudagraph_unsafe ops. This partition happens at inductor codegen time after all passes and fusions are finished. It generates a single call
function which wraps cudagraph-safe ops into partition functions and leave cudagraph-unsafe ops outside the partition functions. For a graph with N cudagraph-unsafe ops (e.g., Attention), there would be N+1 partitions. To mark an op as cudagraph unsafe, we can add tags=(torch._C.Tag.cudagraph_unsafe)
when register the custom op.
This config supports both full cudagraph and piecewise cudagraph without compiling twice. For piecewise cudagraph, it applies vLLM CUDAGraph wrapper to each partition. For N+1 partitions, there would be N+1 CUDAGraph wrapper instances.
For full CUDAGraph, we always apply a single CUDAGraph wrapper outside the inductor call
function in the model runner. The top-level full cudagraph capture ignores all partitioning.
__post_init__ ¶
Source code in vllm/config/compilation.py
__repr__ ¶
__repr__() -> str
Source code in vllm/config/compilation.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/compilation.py
custom_op_log_check ¶
This method logs the enabled/disabled custom ops and checks that the passed custom_ops field only contains relevant ops. It is called at the end of set_current_vllm_config, after the custom ops have been instantiated.
Source code in vllm/config/compilation.py
init_backend ¶
init_backend(
vllm_config: VllmConfig,
) -> Union[str, Callable]
Source code in vllm/config/compilation.py
init_with_cudagraph_sizes ¶
To complete the initialization of config, we need to know the cudagraph sizes.
Source code in vllm/config/compilation.py
is_attention_compiled_piecewise ¶
is_attention_compiled_piecewise() -> bool
Source code in vllm/config/compilation.py
set_splitting_ops_for_attn_fusion ¶
Source code in vllm/config/compilation.py
set_splitting_ops_for_inductor_graph_partition ¶
Source code in vllm/config/compilation.py
set_splitting_ops_for_v1 ¶
Source code in vllm/config/compilation.py
validate_cudagraph_mode_before classmethod
¶
enable parse the cudagraph_mode
enum type from string
Source code in vllm/config/compilation.py
CompilationLevel ¶
Source code in vllm/config/compilation.py
DeviceConfig ¶
Configuration for the device to use for vLLM execution.
Source code in vllm/config/device.py
device class-attribute
instance-attribute
¶
Device type for vLLM execution. This parameter is deprecated and will be removed in a future release. It will now be set automatically based on the current platform.
device_type class-attribute
instance-attribute
¶
Device type from the current platform. This is set in __post_init__
.
__post_init__ ¶
Source code in vllm/config/device.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/device.py
EPLBConfig ¶
Configuration for Expert Parallel Load Balancing (EP).
Source code in vllm/config/parallel.py
log_balancedness class-attribute
instance-attribute
¶
log_balancedness: bool = False
Log the balancedness each step of expert parallelism. This is turned off by default since it will cause communication overhead.
num_redundant_experts class-attribute
instance-attribute
¶
num_redundant_experts: int = 0
Number of redundant experts to use for expert parallelism.
KVEventsConfig ¶
Configuration for KV event publishing.
Source code in vllm/config/kv_events.py
buffer_steps class-attribute
instance-attribute
¶
buffer_steps: int = 10000
The number of steps to cache for replay endpoint. Will only save events from the last N steps for the replay endpoint.
enable_kv_cache_events class-attribute
instance-attribute
¶
enable_kv_cache_events: bool = False
If True, enable KV cache events for tracking block storage and removal. Events can be published externally by zmq using the event publisher config.
endpoint class-attribute
instance-attribute
¶
endpoint: str = 'tcp://*:5557'
The zmq endpoint to use for publishing kv events.
hwm class-attribute
instance-attribute
¶
hwm: int = 100000
The zmq high water mark for the event publisher. After queueing N events, events will start dropping if the consumer is not keeping up.
max_queue_size class-attribute
instance-attribute
¶
max_queue_size: int = 100000
The maximum number of events to queue while waiting for publishing.
publisher class-attribute
instance-attribute
¶
publisher: str = 'null'
The publisher to use for publishing kv events. Can be "null", "zmq".
replay_endpoint class-attribute
instance-attribute
¶
The zmq endpoint to use for replaying kv events.
KVTransferConfig ¶
Configuration for distributed KV cache transfer.
Source code in vllm/config/kv_transfer.py
engine_id class-attribute
instance-attribute
¶
The engine id for KV transfers.
kv_buffer_device class-attribute
instance-attribute
¶
The device used by kv connector to buffer the KV cache. Choices are 'cuda' and 'cpu'.
kv_buffer_size class-attribute
instance-attribute
¶
kv_buffer_size: float = 1000000000.0
The buffer size for TorchDistributedConnector. Measured in number of bytes. Recommended value: 1e9 (about 1GB).
kv_connector class-attribute
instance-attribute
¶
The KV connector for vLLM to transmit KV caches between vLLM instances.
kv_connector_extra_config class-attribute
instance-attribute
¶
any extra config that the connector may need.
kv_connector_module_path class-attribute
instance-attribute
¶
The Python module path to dynamically load the KV connector from. Only supported in V1.
kv_ip class-attribute
instance-attribute
¶
kv_ip: str = '127.0.0.1'
The KV connector ip, used to build distributed connection.
kv_parallel_size class-attribute
instance-attribute
¶
kv_parallel_size: int = 1
The number of parallel instances for KV cache transfer. For P2pNcclConnector, this should be 2.
kv_port class-attribute
instance-attribute
¶
kv_port: int = 14579
The KV connector port, used to build distributed connection.
kv_rank class-attribute
instance-attribute
¶
The rank of this vLLM instance in the KV cache transfer. Typical value: 0 for prefill instance, 1 for decode instance. Currently only 1P1D is supported.
kv_role class-attribute
instance-attribute
¶
Whether this vLLM instance produces, consumes KV cache, or both. Choices are 'kv_producer', 'kv_consumer', and 'kv_both'.
__post_init__ ¶
Source code in vllm/config/kv_transfer.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/kv_transfer.py
LoRAConfig ¶
Configuration for LoRA.
Source code in vllm/config/lora.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 |
|
bias_enabled class-attribute
instance-attribute
¶
bias_enabled: bool = False
[DEPRECATED] Enable bias for LoRA adapters. This option will be removed in v0.12.0.
default_mm_loras class-attribute
instance-attribute
¶
Dictionary mapping specific modalities to LoRA model paths; this field is only applicable to multimodal models and should be leveraged when a model always expects a LoRA to be active when a given modality is present. Note that currently, if a request provides multiple additional modalities, each of which have their own LoRA, we do NOT apply default_mm_loras because we currently only support one lora adapter per prompt. When run in offline mode, the lora IDs for n modalities will be automatically assigned to 1-n with the names of the modalities in alphabetic order.
fully_sharded_loras class-attribute
instance-attribute
¶
fully_sharded_loras: bool = False
By default, only half of the LoRA computation is sharded with tensor parallelism. Enabling this will use the fully sharded layers. At high sequence length, max rank or tensor parallel size, this is likely faster.
lora_dtype class-attribute
instance-attribute
¶
Data type for LoRA. If auto, will default to base model dtype.
lora_extra_vocab_size class-attribute
instance-attribute
¶
lora_extra_vocab_size: int = 256
(Deprecated) Maximum size of extra vocabulary that can be present in a LoRA adapter. Will be removed in v0.12.0.
lora_vocab_padding_size class-attribute
¶
lora_vocab_padding_size: int = get_lora_vocab_padding_size()
max_cpu_loras class-attribute
instance-attribute
¶
Maximum number of LoRAs to store in CPU memory. Must be >= than max_loras
.
max_loras class-attribute
instance-attribute
¶
max_loras: int = 1
Max number of LoRAs in a single batch.
__post_init__ ¶
Source code in vllm/config/lora.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/lora.py
verify_with_cache_config ¶
verify_with_cache_config(cache_config: CacheConfig)
verify_with_model_config ¶
verify_with_model_config(model_config: ModelConfig)
LoadConfig ¶
Configuration for loading the model weights.
Source code in vllm/config/load.py
device class-attribute
instance-attribute
¶
Device to which model weights will be loaded, default to device_config.device
download_dir class-attribute
instance-attribute
¶
Directory to download and load the weights, default to the default cache directory of Hugging Face.
ignore_patterns 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 class-attribute
instance-attribute
¶
load_format: Union[str, LoadFormats] = 'auto'
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.
-
"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.
-
"bitsandbytes" will load the weights using bitsandbytes quantization.
-
"sharded_state" will load weights from pre-sharded checkpoint files, supporting efficient loading of tensor-parallel models.
-
"gguf" will load weights from GGUF format files (details specified in https://github.com/ggml-org/ggml/blob/master/docs/gguf.md).
-
"mistral" will load weights from consolidated safetensors files used by Mistral models.
- Other custom values can be supported via plugins.
model_loader_extra_config class-attribute
instance-attribute
¶
model_loader_extra_config: Union[dict, TensorizerConfig] = (
field(default_factory=dict)
)
Extra config for model loader. This will be passed to the model loader corresponding to the chosen load_format.
pt_load_map_location class-attribute
instance-attribute
¶
pt_load_map_location: 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 needs to be double quoted for json parsing. For more details, see original doc for map_location
in https://pytorch.org/docs/stable/generated/torch.load.html
safetensors_load_strategy class-attribute
instance-attribute
¶
safetensors_load_strategy: str = 'lazy'
Specifies the loading strategy for safetensors weights. - "lazy" (default): Weights are memory-mapped from the file. This enables on-demand loading and is highly efficient for models on local storage. - "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.
use_tqdm_on_load class-attribute
instance-attribute
¶
use_tqdm_on_load: bool = True
Whether to enable tqdm for showing progress bar when loading model weights.
__post_init__ ¶
Source code in vllm/config/load.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/load.py
ModelConfig ¶
Configuration for the model.
Source code in vllm/config/model.py
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 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 |
|
allowed_local_media_path class-attribute
instance-attribute
¶
allowed_local_media_path: str = ''
Allowing API requests to read local images or videos from directories specified by the server file system. This is a security risk. Should only be enabled in trusted environments.
allowed_media_domains class-attribute
instance-attribute
¶
If set, only media URLs that belong to this domain can be used for multi-modal inputs.
code_revision class-attribute
instance-attribute
¶
The specific revision to use for the model code on the Hugging Face Hub. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.
config_format class-attribute
instance-attribute
¶
config_format: Union[str, ConfigFormat] = 'auto'
The format of the model config to load:
-
"auto" will try to load the config in hf format if available else it will try to load in mistral format.
-
"hf" will load the config in hf format.
-
"mistral" will load the config in mistral format.
convert class-attribute
instance-attribute
¶
convert: ConvertOption = 'auto'
Convert the model using adapters defined in vllm.model_executor.models.adapters. The most common use case is to adapt a text generation model to be used for pooling tasks.
disable_cascade_attn class-attribute
instance-attribute
¶
disable_cascade_attn: bool = False
Disable cascade attention for V1. While cascade attention does not change the mathematical correctness, disabling it could be useful for preventing potential numerical issues. Note that even if this is set to False, cascade attention will be only used when the heuristic tells that it's beneficial.
disable_sliding_window class-attribute
instance-attribute
¶
disable_sliding_window: bool = False
Whether to disable sliding window. If True, we will disable the sliding window functionality of the model, capping to sliding window size. If the model does not support sliding window, this argument is ignored.
dtype class-attribute
instance-attribute
¶
dtype: Union[ModelDType, dtype] = 'auto'
Data type for model weights and activations:
-
"auto" will use FP16 precision for FP32 and FP16 models, and BF16 precision for BF16 models.
-
"half" for FP16. Recommended for AWQ quantization.
-
"float16" is the same as "half".
-
"bfloat16" for a balance between precision and range.
-
"float" is shorthand for FP32 precision.
-
"float32" for FP32 precision.
enable_prompt_embeds class-attribute
instance-attribute
¶
enable_prompt_embeds: bool = False
If True
, enables passing text embeddings as inputs via the prompt_embeds
key. Note that enabling this will double the time required for graph compilation.
enable_sleep_mode class-attribute
instance-attribute
¶
enable_sleep_mode: bool = False
Enable sleep mode for the engine (only cuda platform is supported).
enforce_eager class-attribute
instance-attribute
¶
enforce_eager: bool = False
Whether to always use eager-mode PyTorch. If True, we will disable CUDA graph and always execute the model in eager mode. If False, we will use CUDA graph and eager execution in hybrid for maximal performance and flexibility.
generation_config class-attribute
instance-attribute
¶
generation_config: str = 'auto'
The folder path to the generation config. Defaults to "auto"
, the generation config will be loaded from model path. If set to "vllm"
, no generation config is loaded, vLLM defaults will be used. If set to a folder path, the generation config will be loaded from the specified folder path. If max_new_tokens
is specified in generation config, then it sets a server-wide limit on the number of output tokens for all requests.
head_dtype property
¶
head_dtype: dtype
"head" refers to the last Linear layer(s) of an LLM, such as the lm_head in a generation model, or the score or classifier in a classification model.
head_dtype
currently only supports pooling models.
- The pooling model defaults to using fp32 head, you can use --hf-overrides '{"head_dtype": "model"}' to disable it.
hf_config_path class-attribute
instance-attribute
¶
Name or path of the Hugging Face config to use. If unspecified, model name or path will be used.
hf_overrides class-attribute
instance-attribute
¶
hf_overrides: HfOverrides = field(default_factory=dict)
If a dictionary, contains arguments to be forwarded to the Hugging Face config. If a callable, it is called to update the HuggingFace config.
hf_token class-attribute
instance-attribute
¶
The token to use as HTTP bearer authorization for remote files . If True
, will use the token generated when running huggingface-cli login
(stored in ~/.huggingface
).
io_processor_plugin class-attribute
instance-attribute
¶
IOProcessor plugin name to load at model startup
logits_processor_pattern class-attribute
instance-attribute
¶
Optional regex pattern specifying valid logits processor qualified names that can be passed with the logits_processors
extra completion argument. Defaults to None
, which allows no processors.
logits_processors class-attribute
instance-attribute
¶
One or more logits processors' fully-qualified class names or class definitions
logprobs_mode class-attribute
instance-attribute
¶
logprobs_mode: LogprobsMode = 'raw_logprobs'
Indicates the content returned in the logprobs and prompt_logprobs. Supported mode: 1) raw_logprobs, 2) processed_logprobs, 3) raw_logits, 4) processed_logits. Raw means the values before applying any logit processors, like bad words. Processed means the values after applying all processors, including temperature and top_k/top_p.
max_logprobs class-attribute
instance-attribute
¶
max_logprobs: int = 20
Maximum number of log probabilities to return when logprobs
is specified in SamplingParams
. The default value comes the default for the OpenAI Chat Completions API. -1 means no cap, i.e. all (output_length * vocab_size) logprobs are allowed to be returned and it may cause OOM.
max_model_len class-attribute
instance-attribute
¶
max_model_len: SkipValidation[int] = None
Model context length (prompt and output). If unspecified, will be automatically derived from the model config.
When passing via --max-model-len
, supports k/m/g/K/M/G in human-readable format. Examples:
-
1k -> 1000
-
1K -> 1024
-
25.6k -> 25,600
model class-attribute
instance-attribute
¶
model: str = 'Qwen/Qwen3-0.6B'
Name or path of the Hugging Face model to use. It is also used as the content for model_name
tag in metrics output when served_model_name
is not specified.
model_impl class-attribute
instance-attribute
¶
Which implementation of the model to use:
-
"auto" will try to use the vLLM implementation, if it exists, and fall back to the Transformers implementation if no vLLM implementation is available.
-
"vllm" will use the vLLM model implementation.
-
"transformers" will use the Transformers model implementation.
-
"terratorch" will use the TerraTorch model implementation.
multimodal_config class-attribute
instance-attribute
¶
multimodal_config: Optional[MultiModalConfig] = None
Configuration for multimodal model. If None
, this will be inferred from the architecture of self.model
.
override_attention_dtype class-attribute
instance-attribute
¶
Override dtype for attention
override_generation_config class-attribute
instance-attribute
¶
Overrides or sets generation config. e.g. {"temperature": 0.5}
. If used with --generation-config auto
, the override parameters will be merged with the default config from the model. If used with --generation-config vllm
, only the override parameters are used.
override_pooler_config class-attribute
instance-attribute
¶
override_pooler_config: Optional[
Union[dict, PoolerConfig]
] = None
[DEPRECATED] Use pooler_config
instead. This field will be removed in v0.12.0 or v1.0.0, whichever is sooner.
pooler_config class-attribute
instance-attribute
¶
pooler_config: Optional[PoolerConfig] = None
Pooler config which controls the behaviour of output pooling in pooling models.
quantization class-attribute
instance-attribute
¶
quantization: SkipValidation[
Optional[QuantizationMethods]
] = None
Method used to quantize the weights. If None
, we first check the quantization_config
attribute in the model config file. If that is None
, we assume the model weights are not quantized and use dtype
to determine the data type of the weights.
revision class-attribute
instance-attribute
¶
The specific model version to use. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.
rope_scaling class-attribute
instance-attribute
¶
RoPE scaling configuration. For example, {"rope_type":"dynamic","factor":2.0}
.
rope_theta class-attribute
instance-attribute
¶
RoPE theta. Use with rope_scaling
. In some cases, changing the RoPE theta improves the performance of the scaled model.
runner class-attribute
instance-attribute
¶
runner: RunnerOption = 'auto'
The type of model runner to use. Each vLLM instance only supports one model runner, even if the same model can be used for multiple types.
seed class-attribute
instance-attribute
¶
Random seed for reproducibility. Initialized to None in V0, but initialized to 0 in V1.
served_model_name class-attribute
instance-attribute
¶
The model name(s) used in the API. If multiple names are provided, the server will respond to any of the provided names. The model name in the model field of a response will be the first name in this list. If not specified, the model name will be the same as the --model
argument. Noted that this name(s) will also be used in model_name
tag content of prometheus metrics, if multiple names provided, metrics tag will take the first one.
skip_tokenizer_init class-attribute
instance-attribute
¶
skip_tokenizer_init: bool = False
Skip initialization of tokenizer and detokenizer. Expects valid prompt_token_ids
and None
for prompt from the input. The generated output will contain token ids.
spec_target_max_model_len class-attribute
instance-attribute
¶
Specify the maximum length for spec decoding draft models.
task class-attribute
instance-attribute
¶
task: Optional[TaskOption] = None
[DEPRECATED] The task to use the model for. If the model supports more than one model runner, this is used to select which model runner to run.
Note that the model may support other tasks using the same model runner.
tokenizer class-attribute
instance-attribute
¶
tokenizer: SkipValidation[str] = None
Name or path of the Hugging Face tokenizer to use. If unspecified, model name or path will be used.
tokenizer_mode class-attribute
instance-attribute
¶
tokenizer_mode: TokenizerMode = 'auto'
Tokenizer mode:
-
"auto" will use the fast tokenizer if available.
-
"slow" will always use the slow tokenizer.
-
"mistral" will always use the tokenizer from
mistral_common
. -
"custom" will use --tokenizer to select the preregistered tokenizer.
tokenizer_revision class-attribute
instance-attribute
¶
The specific revision to use for the tokenizer on the Hugging Face Hub. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.
trust_remote_code class-attribute
instance-attribute
¶
trust_remote_code: bool = False
Trust remote code (e.g., from HuggingFace) when downloading the model and tokenizer.
__post_init__ ¶
__post_init__(
limit_mm_per_prompt: Optional[dict[str, int]],
media_io_kwargs: Optional[dict[str, dict[str, Any]]],
mm_processor_kwargs: Optional[dict[str, Any]],
mm_processor_cache_gb: Optional[float],
mm_processor_cache_type: Optional[MMCacheType],
mm_shm_cache_max_object_size_mb: Optional[int],
mm_encoder_tp_mode: Optional[MMEncoderTPMode],
interleave_mm_strings: Optional[bool],
skip_mm_profiling: Optional[bool],
video_pruning_rate: Optional[float],
) -> None
Source code in vllm/config/model.py
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
|
_get_convert_type ¶
_get_convert_type(
architectures: list[str],
runner_type: RunnerType,
convert: ConvertOption,
) -> ConvertType
Source code in vllm/config/model.py
_get_default_convert_type ¶
_get_default_convert_type(
architectures: list[str], runner_type: RunnerType
) -> ConvertType
Source code in vllm/config/model.py
_get_default_pooling_task ¶
Source code in vllm/config/model.py
_get_default_runner_type ¶
_get_default_runner_type(
architectures: list[str],
) -> RunnerType
Source code in vllm/config/model.py
_get_encoder_config ¶
_get_runner_type ¶
_get_runner_type(
architectures: list[str], runner: RunnerOption
) -> RunnerType
Source code in vllm/config/model.py
_get_transformers_backend_cls ¶
_get_transformers_backend_cls() -> str
Determine which Transformers backend class will be used if model_impl
is set to transformers
or auto
.
Source code in vllm/config/model.py
_parse_quant_hf_config ¶
Source code in vllm/config/model.py
_verify_bnb_config ¶
The current version of bitsandbytes (0.46.1) with 8-bit models does not yet support CUDA graph.
TODO Remove this when bitsandbytes supports.¶
Source code in vllm/config/model.py
_verify_cuda_graph ¶
Source code in vllm/config/model.py
_verify_quantization ¶
Source code in vllm/config/model.py
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 |
|
_verify_tokenizer_mode ¶
Source code in vllm/config/model.py
_verify_with_expert_parallelism ¶
Source code in vllm/config/model.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/model.py
get_and_verify_max_len ¶
get_and_verify_max_len(max_model_len: int)
Source code in vllm/config/model.py
get_diff_sampling_param ¶
This method returns a dictionary containing the non-default sampling parameters with override_generation_config
applied.
The default sampling parameters are:
- vLLM's neutral defaults if
self.generation_config="vllm"
- the model's defaults if
self.generation_config="auto"
- as defined in
generation_config.json
ifself.generation_config="path/to/generation_config/dir"
Returns:
Type | Description |
---|---|
dict[str, Any] | A dictionary containing the non-default sampling parameters. |
Source code in vllm/config/model.py
get_head_size ¶
get_head_size() -> int
Source code in vllm/config/model.py
get_layers_start_end_indices ¶
get_layers_start_end_indices(
parallel_config: ParallelConfig,
) -> tuple[int, int]
Source code in vllm/config/model.py
get_mamba_chunk_size ¶
Returns the mamba chunk size if it exists
Source code in vllm/config/model.py
get_multimodal_config ¶
get_multimodal_config() -> MultiModalConfig
Get the multimodal configuration of the model.
Raises:
Type | Description |
---|---|
ValueError | If the model is not multimodal. |
Source code in vllm/config/model.py
get_num_attention_heads ¶
get_num_attention_heads(
parallel_config: ParallelConfig,
) -> int
get_num_kv_heads ¶
get_num_kv_heads(parallel_config: ParallelConfig) -> int
Returns the number of KV heads per GPU.
Source code in vllm/config/model.py
get_num_layers ¶
get_num_layers(parallel_config: ParallelConfig) -> int
get_num_layers_by_block_type ¶
get_num_layers_by_block_type(
parallel_config: ParallelConfig,
block_type: LayerBlockType = attention,
) -> int
Source code in vllm/config/model.py
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 |
|
get_sliding_window ¶
get_total_num_kv_heads ¶
get_total_num_kv_heads() -> int
Returns the total number of KV heads.
Source code in vllm/config/model.py
maybe_pull_model_tokenizer_for_runai ¶
Pull model/tokenizer from Object Storage to temporary directory when needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model | str | Model name or path | required |
tokenizer | str | Tokenizer name or path | required |
Source code in vllm/config/model.py
try_get_generation_config ¶
This method attempts to retrieve the non-default values of the generation config for this model.
The generation config can contain information about special tokens, as well as sampling parameters. Which is why this method exists separately to get_diff_sampling_param
.
Returns:
Type | Description |
---|---|
dict[str, Any] | A dictionary containing the non-default generation config. |
Source code in vllm/config/model.py
validate_model_config_after ¶
validate_model_config_after() -> ModelConfig
Source code in vllm/config/model.py
validate_quantization_before classmethod
¶
verify_dual_chunk_attention_config ¶
verify_dual_chunk_attention_config(
load_config: LoadConfig,
) -> None
Source code in vllm/config/model.py
verify_with_parallel_config ¶
verify_with_parallel_config(
parallel_config: ParallelConfig,
) -> None
Source code in vllm/config/model.py
MultiModalConfig ¶
Controls the behavior of multimodal models.
Source code in vllm/config/multimodal.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 |
|
interleave_mm_strings class-attribute
instance-attribute
¶
interleave_mm_strings: bool = False
Enable fully interleaved support for multimodal prompts, while using --chat-template-content-format=string.
limit_per_prompt class-attribute
instance-attribute
¶
The maximum number of input items allowed per prompt for each modality. Defaults to 1 (V0) or 999 (V1) for each modality.
For example, to allow up to 16 images and 2 videos per prompt: {"image": 16, "video": 2}
media_io_kwargs class-attribute
instance-attribute
¶
Additional args passed to process media inputs, keyed by modalities. For example, to set num_frames for video, set --media-io-kwargs '{"video": {"num_frames": 40} }'
mm_encoder_tp_mode class-attribute
instance-attribute
¶
mm_encoder_tp_mode: MMEncoderTPMode = 'weights'
Indicates how to optimize multi-modal encoder inference using tensor parallelism (TP).
-
"weights"
: Within the same vLLM engine, split the weights of each layer across TP ranks. (default TP behavior) -
"data"
: Within the same vLLM engine, split the batched input data across TP ranks to process the data in parallel, while hosting the full weights on each TP rank. This batch-level DP is not to be confused with API request-level DP (which is controlled by--data-parallel-size
). This is only supported on a per-model basis and falls back to"weights"
if the encoder does not support DP.
mm_processor_cache_gb class-attribute
instance-attribute
¶
mm_processor_cache_gb: float = 4
The size (in GiB) of the multi-modal processor cache, which is used to avoid re-processing past multi-modal inputs.
This cache is duplicated for each API process and engine core process, resulting in a total memory usage of mm_processor_cache_gb * (api_server_count + data_parallel_size)
.
Set to 0
to disable this cache completely (not recommended).
mm_processor_cache_type class-attribute
instance-attribute
¶
mm_processor_cache_type: MMCacheType = 'lru'
Type of cache to use for the multi-modal preprocessor/mapper. If shm
, use shared memory FIFO cache. If lru
, use mirrored LRU cache.
mm_processor_kwargs class-attribute
instance-attribute
¶
Arguments to be forwarded to the model's processor for multi-modal data, e.g., image processor. Overrides for the multi-modal processor obtained from transformers.AutoProcessor.from_pretrained
.
The available overrides depend on the model that is being run.
For example, for Phi-3-Vision: {"num_crops": 4}
.
mm_shm_cache_max_object_size_mb class-attribute
instance-attribute
¶
mm_shm_cache_max_object_size_mb: int = 128
Size limit (in MiB) for each object stored in the multi-modal processor shared memory cache. Only effective when mm_processor_cache_type
is "shm"
.
skip_mm_profiling class-attribute
instance-attribute
¶
skip_mm_profiling: bool = False
When enabled, skips multimodal memory profiling and only profiles with language backbone model during engine initialization.
This reduces engine startup time but shifts the responsibility to users for estimating the peak memory usage of the activation of multimodal encoder and embedding cache.
video_pruning_rate class-attribute
instance-attribute
¶
Sets pruning rate for video pruning via Efficient Video Sampling. Value sits in range [0;1) and determines fraction of media tokens from each video to be pruned.
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/multimodal.py
get_limit_per_prompt ¶
Get the maximum number of input items allowed per prompt for the given modality.
is_multimodal_pruning_enabled ¶
merge_mm_processor_kwargs ¶
Get the keyword arguments to pass to the multi-modal processor according to the extra arguments passed during inference.
Source code in vllm/config/multimodal.py
ObservabilityConfig ¶
Configuration for observability - metrics and tracing.
Source code in vllm/config/observability.py
collect_detailed_traces class-attribute
instance-attribute
¶
collect_detailed_traces: Optional[
list[DetailedTraceModules]
] = None
It makes sense to set this only if --otlp-traces-endpoint
is set. If set, it will collect detailed traces for the specified modules. This involves use of possibly costly and or blocking operations and hence might have a performance impact.
Note that collecting detailed timing information for each request can be expensive.
collect_model_execute_time cached
property
¶
collect_model_execute_time: bool
Whether to collect model execute time for the request.
collect_model_forward_time cached
property
¶
collect_model_forward_time: bool
Whether to collect model forward time for the request.
otlp_traces_endpoint class-attribute
instance-attribute
¶
Target URL to which OpenTelemetry traces will be sent.
show_hidden_metrics cached
property
¶
show_hidden_metrics: bool
Check if the hidden metrics should be shown.
show_hidden_metrics_for_version class-attribute
instance-attribute
¶
Enable deprecated Prometheus metrics that have been hidden since the specified version. For example, if a previously deprecated metric has been hidden since the v0.7.0 release, you use --show-hidden-metrics-for-version=0.7
as a temporary escape hatch while you migrate to new metrics. The metric is likely to be removed completely in an upcoming release.
__post_init__ ¶
Source code in vllm/config/observability.py
_parse_collect_detailed_traces ¶
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/observability.py
ParallelConfig ¶
Configuration for the distributed execution.
Source code in vllm/config/parallel.py
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 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
|
_api_process_count class-attribute
instance-attribute
¶
_api_process_count: int = 1
The number of API processes initialized.
Note
This is an internal config that is only valid for and should only be set by API server scale-out.
_api_process_rank class-attribute
instance-attribute
¶
_api_process_rank: int = 0
The rank of this API process, or -1
for engine core processes under API server scale-out.
Note
This is an internal config that is only valid for and should only be set by API server scale-out.
_data_parallel_master_port_list class-attribute
instance-attribute
¶
List of open port auto-queried for data parallel messaging. Set to be private as it's not intended to be configured by users.
data_parallel_backend class-attribute
instance-attribute
¶
data_parallel_backend: str = 'mp'
Backend to use for data parallel, either "mp" or "ray".
data_parallel_external_lb class-attribute
instance-attribute
¶
data_parallel_external_lb: bool = False
Whether to use "external" DP LB mode. Applies only to online serving and when data_parallel_size > 0. This is useful for a "one-pod-per-rank" wide-EP setup in Kubernetes. Set implicitly when --data-parallel-rank is provided explicitly to vllm serve.
data_parallel_hybrid_lb class-attribute
instance-attribute
¶
data_parallel_hybrid_lb: bool = False
Whether to use "hybrid" DP LB mode. Applies only to online serving and when data_parallel_size > 0. Enables running an AsyncLLM and API server on a "per-node" basis where vLLM load balances between local data parallel ranks, but an external LB balances between vLLM nodes/replicas. Set explicitly in conjunction with --data-parallel-start-rank.
data_parallel_master_ip class-attribute
instance-attribute
¶
data_parallel_master_ip: str = '127.0.0.1'
IP of the data parallel master.
data_parallel_master_port class-attribute
instance-attribute
¶
data_parallel_master_port: int = 29500
Port of the data parallel master.
data_parallel_rank class-attribute
instance-attribute
¶
data_parallel_rank: int = 0
Rank of the data parallel group.
data_parallel_rank_local class-attribute
instance-attribute
¶
Local rank of the data parallel group, set only in SPMD mode.
data_parallel_rpc_port class-attribute
instance-attribute
¶
data_parallel_rpc_port: int = 29550
Port for data parallel messaging.
data_parallel_size class-attribute
instance-attribute
¶
data_parallel_size: int = 1
Number of data parallel groups. MoE layers will be sharded according to the product of the tensor parallel size and data parallel size.
data_parallel_size_local class-attribute
instance-attribute
¶
data_parallel_size_local: int = 1
Number of local data parallel groups.
dbo_decode_token_threshold class-attribute
instance-attribute
¶
dbo_decode_token_threshold: int = 32
The threshold for dual batch overlap for batches only containing decodes. If the number of tokens in the request is greater than this threshold, microbatching will be used. Otherwise, the request will be processed in a single batch.
dbo_prefill_token_threshold class-attribute
instance-attribute
¶
dbo_prefill_token_threshold: int = 512
The threshold for dual batch overlap for batches that contain one or more prefills. If the number of tokens in the request is greater than this threshold, microbatching will be used. Otherwise, the request will be processed in a single batch.
decode_context_parallel_size class-attribute
instance-attribute
¶
decode_context_parallel_size: int = 1
Number of decode context parallel groups, because the world size does not change by dcp, it simply reuse the GPUs of TP group, and tp_size needs to be divisible by dcp_size.
disable_custom_all_reduce class-attribute
instance-attribute
¶
disable_custom_all_reduce: bool = False
Disable the custom all-reduce kernel and fall back to NCCL.
distributed_executor_backend class-attribute
instance-attribute
¶
distributed_executor_backend: Optional[
Union[
str, DistributedExecutorBackend, type[ExecutorBase]
]
] = None
Backend to use for distributed model workers, either "ray" or "mp" (multiprocessing). If the product of pipeline_parallel_size and tensor_parallel_size is less than or equal to the number of GPUs available, "mp" will be used to keep processing on a single host. Otherwise, this will default to "ray" if Ray is installed and fail otherwise. Note that tpu only support Ray for distributed inference.
enable_dbo class-attribute
instance-attribute
¶
enable_dbo: bool = False
Enable dual batch overlap for the model executor.
enable_eplb class-attribute
instance-attribute
¶
enable_eplb: bool = False
Enable expert parallelism load balancing for MoE layers.
enable_expert_parallel class-attribute
instance-attribute
¶
enable_expert_parallel: bool = False
Use expert parallelism instead of tensor parallelism for MoE layers.
eplb_config class-attribute
instance-attribute
¶
eplb_config: EPLBConfig = field(default_factory=EPLBConfig)
Expert parallelism configuration.
eplb_log_balancedness class-attribute
instance-attribute
¶
eplb_log_balancedness
is deprecated and has been replaced with eplb_config.log_balancedness
. This will be removed in v0.12.0. Please use eplb_config.log_balancedness
instead.
eplb_step_interval class-attribute
instance-attribute
¶
eplb_step_interval
is deprecated and has been replaced with eplb_config.step_interval
. This will be removed in v0.12.0. Please use eplb_config.step_interval
instead.
eplb_window_size class-attribute
instance-attribute
¶
eplb_window_size
is deprecated and has been replaced with eplb_config.window_size
. This will be removed in v0.12.0. Please use eplb_config.window_size
instead.
expert_placement_strategy class-attribute
instance-attribute
¶
expert_placement_strategy: ExpertPlacementStrategy = (
"linear"
)
The expert placement strategy for MoE layers:
-
"linear": Experts are placed in a contiguous manner. For example, with 4 experts and 2 ranks, rank 0 will have experts [0, 1] and rank 1 will have experts [2, 3].
-
"round_robin": Experts are placed in a round-robin manner. For example, with 4 experts and 2 ranks, rank 0 will have experts [0, 2] and rank 1 will have experts [1, 3]. This strategy can help improve load balancing for grouped expert models with no redundant experts.
max_parallel_loading_workers class-attribute
instance-attribute
¶
Maximum number of parallel loading workers when loading model sequentially in multiple batches. To avoid RAM OOM when using tensor parallel and large models.
num_redundant_experts class-attribute
instance-attribute
¶
num_redundant_experts
is deprecated and has been replaced with eplb_config.num_redundant_experts
. This will be removed in v0.12.0. Please use eplb_config.num_redundant_experts
instead.
pipeline_parallel_size class-attribute
instance-attribute
¶
pipeline_parallel_size: int = 1
Number of pipeline parallel groups.
placement_group class-attribute
instance-attribute
¶
placement_group: Optional[PlacementGroup] = None
ray distributed model workers placement group.
ray_runtime_env class-attribute
instance-attribute
¶
ray_runtime_env: Optional[RuntimeEnv] = None
Ray runtime environment to pass to distributed workers.
ray_workers_use_nsight class-attribute
instance-attribute
¶
ray_workers_use_nsight: bool = False
Whether to profile Ray workers with nsight, see https://docs.ray.io/en/latest/ray-observability/user-guides/profiling.html#profiling-nsight-profiler.
sd_worker_cls class-attribute
instance-attribute
¶
sd_worker_cls: str = 'auto'
The full name of the worker class to use for speculative decoding. If "auto", the worker class will be determined based on the platform.
tensor_parallel_size class-attribute
instance-attribute
¶
tensor_parallel_size: int = 1
Number of tensor parallel groups.
worker_cls class-attribute
instance-attribute
¶
worker_cls: str = 'auto'
The full name of the worker class to use. If "auto", the worker class will be determined based on the platform.
worker_extension_cls class-attribute
instance-attribute
¶
worker_extension_cls: str = ''
The full name of the worker extension class to use. The worker extension class is dynamically inherited by the worker class. This is used to inject new attributes and methods to the worker class for use in collective_rpc calls.
world_size class-attribute
instance-attribute
¶
world_size is TPxPP, it affects the number of workers we create.
world_size_across_dp property
¶
world_size_across_dp: int
world_size_across_dp is TPxPPxDP, it is the size of the world including data parallelism.
__post_init__ ¶
Source code in vllm/config/parallel.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
|
_verify_args ¶
_verify_args() -> Self
Source code in vllm/config/parallel.py
compute_hash ¶
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/parallel.py
get_next_dp_init_port ¶
get_next_dp_init_port() -> int
We might need to initialize process groups in multiple processes that is related to data parallelism, e.g. both in the worker and in the engine, which can live in different processes. To avoid port conflicts, we pop a new port from the prepared port list each time we need to initialize a new process group related to data parallelism.
Source code in vllm/config/parallel.py
has_unfinished_dp staticmethod
¶
Source code in vllm/config/parallel.py
stateless_init_dp_group ¶
Source code in vllm/config/parallel.py
sync_kv_cache_memory_size staticmethod
¶
Source code in vllm/config/parallel.py
PassConfig ¶
Configuration for custom Inductor passes.
This is separate from general CompilationConfig
so that inductor passes don't all have access to full configuration - that would create a cycle as the PassManager
is set as a property of config.
Source code in vllm/config/compilation.py
enable_async_tp class-attribute
instance-attribute
¶
enable_async_tp: bool = False
Whether to enable async TP.
enable_attn_fusion class-attribute
instance-attribute
¶
enable_attn_fusion: bool = False
Whether to enable the custom attention+quant fusion pass.
enable_fi_allreduce_fusion class-attribute
instance-attribute
¶
enable_fi_allreduce_fusion: bool = False
Whether to enable flashinfer allreduce fusion.
enable_fusion class-attribute
instance-attribute
¶
enable_fusion: bool = False
Whether to enable the custom fusion (RMSNorm/SiluMul+quant) pass.
enable_noop class-attribute
instance-attribute
¶
enable_noop: bool = False
Whether to enable the custom no-op elimination pass.
enable_sequence_parallelism class-attribute
instance-attribute
¶
enable_sequence_parallelism: bool = False
Whether to enable sequence parallelism.
fi_allreduce_fusion_max_token_num class-attribute
instance-attribute
¶
fi_allreduce_fusion_max_token_num: int = 16384
Max number of tokens to used in flashinfer allreduce fusion.
__post_init__ ¶
Source code in vllm/config/compilation.py
uuid ¶
Produces a hash unique to the pass configuration. Any new fields that affect compilation should be added to the hash. Any future fields that don't affect compilation should be excluded.
Source code in vllm/config/compilation.py
PoolerConfig ¶
Controls the behavior of output pooling in pooling models.
Source code in vllm/config/pooler.py
activation class-attribute
instance-attribute
¶
Whether to apply activation function to the classification outputs. Defaults to True.
dimensions class-attribute
instance-attribute
¶
Reduce the dimensions of embeddings if model support matryoshka representation. Defaults to None.
enable_chunked_processing class-attribute
instance-attribute
¶
Whether to enable chunked processing for long inputs that exceed the model's maximum position embeddings. When enabled, long inputs will be split into chunks, processed separately, and then aggregated using weighted averaging. This allows embedding models to handle arbitrarily long text without CUDA errors. Defaults to False.
logit_bias class-attribute
instance-attribute
¶
If provided, apply classification logit biases. Defaults to None.
max_embed_len class-attribute
instance-attribute
¶
Maximum input length allowed for embedding generation. When set, allows inputs longer than max_embed_len to be accepted for embedding models. When an input exceeds max_embed_len, it will be handled according to the original max_model_len validation logic. Defaults to None (i.e. set to max_model_len).
normalize class-attribute
instance-attribute
¶
Whether to normalize the embeddings outputs. Defaults to True.
pooling_type class-attribute
instance-attribute
¶
The pooling method of the pooling model. This should be a key in vllm.model_executor.layers.pooler.PoolingType
.
returned_token_ids class-attribute
instance-attribute
¶
A list of indices for the vocabulary dimensions to be extracted, such as the token IDs of good_token
and bad_token
in the math-shepherd-mistral-7b-prm
model.
softmax class-attribute
instance-attribute
¶
Whether to apply softmax to the reward outputs. Defaults to True.
step_tag_id class-attribute
instance-attribute
¶
If set, only the score corresponding to the step_tag_id
in the generated sentence should be returned. Otherwise, the scores for all tokens are returned.
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/pooler.py
SchedulerConfig ¶
Scheduler configuration.
Source code in vllm/config/scheduler.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
async_scheduling class-attribute
instance-attribute
¶
async_scheduling: bool = False
EXPERIMENTAL: If set to True, perform async scheduling. This may help reduce the CPU overheads, leading to better latency and throughput. However, async scheduling is currently not supported with some features such as structured outputs, speculative decoding, and pipeline parallelism.
chunked_prefill_enabled class-attribute
instance-attribute
¶
True if chunked prefill is enabled.
cuda_graph_sizes class-attribute
instance-attribute
¶
Cuda graph capture sizes 1. if none provided, then default set to [min(max_num_seqs * 2, 512)] 2. if one value is provided, then the capture list would follow the pattern: [1, 2, 4] + [i for i in range(8, cuda_graph_sizes + 1, 8)] 3. more than one value (e.g. 1 2 128) is provided, then the capture list will follow the provided list.
disable_chunked_mm_input class-attribute
instance-attribute
¶
disable_chunked_mm_input: bool = False
If set to true and chunked prefill is enabled, we do not want to partially schedule a multimodal item. Only used in V1 This ensures that if a request has a mixed prompt (like text tokens TTTT followed by image tokens IIIIIIIIII) where only some image tokens can be scheduled (like TTTTIIIII, leaving IIIII), it will be scheduled as TTTT in one step and IIIIIIIIII in the next.
disable_hybrid_kv_cache_manager class-attribute
instance-attribute
¶
disable_hybrid_kv_cache_manager: bool = False
If set to True, KV cache manager will allocate the same size of KV cache for all attention layers even if there are multiple type of attention layers like full attention and sliding window attention.
enable_chunked_prefill class-attribute
instance-attribute
¶
enable_chunked_prefill: SkipValidation[bool] = None
If True, prefill requests can be chunked based on the remaining max_num_batched_tokens.
encoder_cache_size class-attribute
instance-attribute
¶
Multimodal encoder cache size, only used in V1.
NOTE: This is not currently configurable. It will be overridden by max_num_batched_tokens in case max multimodal embedding size is larger.
is_multimodal_model class-attribute
instance-attribute
¶
is_multimodal_model: bool = False
True if the model is multimodal.
long_prefill_token_threshold class-attribute
instance-attribute
¶
long_prefill_token_threshold: int = 0
For chunked prefill, a request is considered long if the prompt is longer than this number of tokens.
max_long_partial_prefills class-attribute
instance-attribute
¶
max_long_partial_prefills: int = 1
For chunked prefill, the maximum number of prompts longer than long_prefill_token_threshold that will be prefilled concurrently. Setting this less than max_num_partial_prefills will allow shorter prompts to jump the queue in front of longer prompts in some cases, improving latency.
max_model_len class-attribute
instance-attribute
¶
max_model_len: SkipValidation[int] = None
Maximum length of a sequence (including prompt and generated text). This is primarily set in ModelConfig
and that value should be manually duplicated here.
max_num_batched_tokens class-attribute
instance-attribute
¶
max_num_batched_tokens: SkipValidation[int] = None
Maximum number of tokens to be processed in a single iteration.
This config has no static default. If left unspecified by the user, it will be set in EngineArgs.create_engine_config
based on the usage context.
max_num_encoder_input_tokens class-attribute
instance-attribute
¶
Multimodal encoder compute budget, only used in V1.
NOTE: This is not currently configurable. It will be overridden by max_num_batched_tokens in case max multimodal embedding size is larger.
max_num_partial_prefills class-attribute
instance-attribute
¶
max_num_partial_prefills: int = 1
For chunked prefill, the maximum number of sequences that can be partially prefilled concurrently.
max_num_seqs class-attribute
instance-attribute
¶
max_num_seqs: SkipValidation[int] = None
Maximum number of sequences to be processed in a single iteration.
This config has no static default. If left unspecified by the user, it will be set in EngineArgs.create_engine_config
based on the usage context.
num_lookahead_slots class-attribute
instance-attribute
¶
num_lookahead_slots: int = 0
The number of slots to allocate per sequence per step, beyond the known token ids. This is used in speculative decoding to store KV activations of tokens which may or may not be accepted.
NOTE: This will be replaced by speculative config in the future; it is present to enable correctness tests until then.
policy class-attribute
instance-attribute
¶
policy: SchedulerPolicy = 'fcfs'
The scheduling policy to use:
-
"fcfs" means first come first served, i.e. requests are handled in order of arrival.
-
"priority" means requests are handled based on given priority (lower value means earlier handling) and time of arrival deciding any ties).
runner_type class-attribute
instance-attribute
¶
runner_type: RunnerType = 'generate'
The runner type to launch for the model.
scheduler_cls class-attribute
instance-attribute
¶
The scheduler class to use. "vllm.core.scheduler.Scheduler" is the default scheduler. Can be a class directly or the path to a class of form "mod.custom_class".
send_delta_data class-attribute
instance-attribute
¶
send_delta_data: bool = False
Private API. If used, scheduler sends delta data to workers instead of an entire data. It should be enabled only when SPMD worker architecture is enabled. I.e., VLLM_USE_RAY_SPMD_WORKER=1
__post_init__ ¶
__post_init__(is_encoder_decoder: bool) -> None
Source code in vllm/config/scheduler.py
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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
_verify_args ¶
_verify_args() -> Self
Source code in vllm/config/scheduler.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/scheduler.py
SpeculativeConfig ¶
Configuration for speculative decoding.
Source code in vllm/config/speculative.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
|
code_revision class-attribute
instance-attribute
¶
The specific revision to use for the draft model code on Hugging Face Hub. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.
disable_by_batch_size class-attribute
instance-attribute
¶
Disable speculative decoding for new incoming requests when the number of enqueued requests is larger than this value, if provided.
disable_log_stats class-attribute
instance-attribute
¶
disable_log_stats: SkipValidation[bool] = None
Whether to disable the periodic printing of stage times in speculative decoding.
disable_logprobs class-attribute
instance-attribute
¶
disable_logprobs: bool = True
If set to True, token log probabilities are not returned during speculative decoding. If set to False, token log probabilities are returned according to the log probability settings in SamplingParams.
disable_padded_drafter_batch class-attribute
instance-attribute
¶
disable_padded_drafter_batch: bool = False
Disable input padding for speculative decoding. If set to True, speculative input batches can contain sequences of different lengths, which may only be supported by certain attention backends. This currently only affects the EAGLE method of speculation.
draft_model_config class-attribute
instance-attribute
¶
draft_model_config: SkipValidation[ModelConfig] = None
The configuration of the draft model initialized internal.
draft_parallel_config class-attribute
instance-attribute
¶
draft_parallel_config: SkipValidation[ParallelConfig] = None
The parallel configuration for the draft model initialized internal.
draft_tensor_parallel_size class-attribute
instance-attribute
¶
The degree of the tensor parallelism for the draft model. Can only be 1 or the same as the target model's tensor parallel size.
enable_chunked_prefill class-attribute
instance-attribute
¶
enable_chunked_prefill: SkipValidation[bool] = None
Whether vLLM is configured to use chunked prefill or not. Used for raising an error since it's not yet compatible with speculative decode.
max_model_len class-attribute
instance-attribute
¶
The maximum model length of the draft model. Used when testing the ability to skip speculation for some sequences.
method class-attribute
instance-attribute
¶
method: Optional[SpeculativeMethod] = None
The name of the speculative method to use. If users provide and set the model
param, the speculative method type will be detected automatically if possible, if model
param is not provided, the method name must be provided.
If using ngram
method, the related configuration prompt_lookup_max
and prompt_lookup_min
should be considered.
model class-attribute
instance-attribute
¶
The name of the draft model, eagle head, or additional weights, if provided.
num_lookahead_slots property
¶
num_lookahead_slots: int
The number of additional slots the scheduler should allocate per step, in addition to the slots allocated for each known token.
This is equal to the number of speculative tokens, as each speculative token must be scored.
num_speculative_tokens class-attribute
instance-attribute
¶
num_speculative_tokens: SkipValidation[int] = None
The number of speculative tokens, if provided. It will default to the number in the draft model config if present, otherwise, it is required.
prompt_lookup_max class-attribute
instance-attribute
¶
Maximum size of ngram token window when using Ngram proposer, required when method is set to ngram.
prompt_lookup_min class-attribute
instance-attribute
¶
Minimum size of ngram token window when using Ngram proposer, if provided. Defaults to 1.
quantization class-attribute
instance-attribute
¶
quantization: Optional[QuantizationMethods] = None
Quantization method that was used to quantize the draft model weights. If None
, we assume the model weights are not quantized. Note that it only takes effect when using the draft model-based speculative method.
revision class-attribute
instance-attribute
¶
The specific model version to use for the draft model. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.
speculative_token_tree class-attribute
instance-attribute
¶
Specifies the tree structure for speculative token generation.
target_model_config class-attribute
instance-attribute
¶
target_model_config: SkipValidation[ModelConfig] = None
The configuration of the target model.
target_parallel_config class-attribute
instance-attribute
¶
target_parallel_config: SkipValidation[ParallelConfig] = (
None
)
The parallel configuration for the target model.
__post_init__ ¶
Source code in vllm/config/speculative.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
|
_maybe_override_draft_max_model_len staticmethod
¶
_maybe_override_draft_max_model_len(
speculative_max_model_len: Optional[int],
draft_max_model_len: int,
target_max_model_len: int,
) -> int
Determine the max sequence len for the draft model. This is usually the draft_max_model_len, but may be the target_max_model_len if it is less than the draft_max_model_len, or may be speculative_max_model_len if it is specified.
This is necessary so that sequences do not exceed the capacity of the draft model or the target model.
speculative_max_model_len is mainly used for testing that sequences can skip speculation.
Source code in vllm/config/speculative.py
_verify_and_get_draft_tp staticmethod
¶
_verify_and_get_draft_tp(
target_parallel_config: ParallelConfig,
speculative_draft_tensor_parallel_size: Optional[int],
draft_hf_config: PretrainedConfig,
) -> int
Verifies and adjusts the tensor parallel size for a draft model specified using speculative_draft_tensor_parallel_size.
Source code in vllm/config/speculative.py
_verify_args ¶
_verify_args() -> Self
Source code in vllm/config/speculative.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/speculative.py
create_draft_parallel_config staticmethod
¶
create_draft_parallel_config(
target_parallel_config: ParallelConfig,
speculative_draft_tensor_parallel_size: int,
) -> ParallelConfig
Create a parallel config for use by the draft worker.
This is mostly a copy of the target parallel config, except the tp_size.
Source code in vllm/config/speculative.py
hf_config_override staticmethod
¶
Source code in vllm/config/speculative.py
SpeechToTextConfig ¶
Configuration for speech-to-text models.
Source code in vllm/config/speech_to_text.py
max_audio_clip_s class-attribute
instance-attribute
¶
max_audio_clip_s: int = 30
Maximum duration in seconds for a single audio clip without chunking. Audio longer than this will be split into smaller chunks if allow_audio_chunking
evaluates to True, otherwise it will be rejected.
min_energy_split_window_size class-attribute
instance-attribute
¶
Window size in samples for finding low-energy (quiet) regions to split audio chunks. The algorithm looks for the quietest moment within this window to minimize cutting through speech. Default 1600 samples ≈ 100ms at 16kHz. If None, no chunking will be done.
StructuredOutputsConfig ¶
Dataclass which contains structured outputs config for the engine.
Source code in vllm/config/structured_outputs.py
backend class-attribute
instance-attribute
¶
backend: StructuredOutputsBackend = 'auto'
Which engine will be used for structured outputs (e.g. JSON schema, regex, etc) by default. With "auto", we will make opinionated choices based on request contents and what the backend libraries currently support, so the behavior is subject to change in each release.
disable_additional_properties class-attribute
instance-attribute
¶
disable_additional_properties: bool = False
If True
, the guidance
backend will not use additionalProperties
in the JSON schema. This is only supported for the guidance
backend and is used to better align its behaviour with outlines
and xgrammar
.
disable_any_whitespace class-attribute
instance-attribute
¶
disable_any_whitespace: bool = False
If True
, the model will not generate any whitespace during structured outputs. This is only supported for xgrammar and guidance backends.
disable_fallback class-attribute
instance-attribute
¶
disable_fallback: bool = False
If True
, vLLM will not fallback to a different backend on error.
reasoning_parser class-attribute
instance-attribute
¶
reasoning_parser: str = ''
Select the reasoning parser depending on the model that you're using. This is used to parse the reasoning content into OpenAI API format.
__post_init__ ¶
Source code in vllm/config/structured_outputs.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/structured_outputs.py
SupportsMetricsInfo ¶
VllmConfig ¶
Dataclass which contains all vllm-related configuration. This simplifies passing around the distinct configurations in the codebase.
Source code in vllm/config/vllm.py
51 52 53 54 55 56 57 58 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 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
|
additional_config class-attribute
instance-attribute
¶
additional_config: Union[dict, SupportsHash] = field(
default_factory=dict
)
Additional config for specified platform. Different platforms may support different configs. Make sure the configs are valid for the platform you are using. Contents must be hashable.
cache_config class-attribute
instance-attribute
¶
cache_config: CacheConfig = field(
default_factory=CacheConfig
)
Cache configuration.
compilation_config class-attribute
instance-attribute
¶
compilation_config: CompilationConfig = field(
default_factory=CompilationConfig
)
torch.compile
and cudagraph capture configuration for the model.
As a shorthand, -O<n>
can be used to directly specify the compilation level n
: -O3
is equivalent to -O.level=3
(same as -O='{"level":3}'
). Currently, -O
NOTE: level 0 is the default level without any optimization. level 1 and 2 are for internal testing only. level 3 is the recommended level for production, also default in V1.
You can specify the full compilation config like so: {"level": 3, "cudagraph_capture_sizes": [1, 2, 4, 8]}
device_config class-attribute
instance-attribute
¶
device_config: DeviceConfig = field(
default_factory=DeviceConfig
)
Device configuration.
kv_events_config class-attribute
instance-attribute
¶
kv_events_config: Optional[KVEventsConfig] = None
The configurations for event publishing.
kv_transfer_config class-attribute
instance-attribute
¶
kv_transfer_config: Optional[KVTransferConfig] = None
The configurations for distributed KV cache transfer.
load_config class-attribute
instance-attribute
¶
load_config: LoadConfig = field(default_factory=LoadConfig)
Load configuration.
lora_config class-attribute
instance-attribute
¶
lora_config: Optional[LoRAConfig] = None
LoRA configuration.
model_config class-attribute
instance-attribute
¶
model_config: ModelConfig = None
Model configuration.
observability_config class-attribute
instance-attribute
¶
observability_config: Optional[ObservabilityConfig] = None
Observability configuration.
parallel_config class-attribute
instance-attribute
¶
parallel_config: ParallelConfig = field(
default_factory=ParallelConfig
)
Parallel configuration.
quant_config class-attribute
instance-attribute
¶
quant_config: Optional[QuantizationConfig] = None
Quantization configuration.
scheduler_config class-attribute
instance-attribute
¶
scheduler_config: SchedulerConfig = field(
default_factory=SchedulerConfig
)
Scheduler configuration.
speculative_config class-attribute
instance-attribute
¶
speculative_config: Optional[SpeculativeConfig] = None
Speculative decoding configuration.
structured_outputs_config class-attribute
instance-attribute
¶
structured_outputs_config: StructuredOutputsConfig = field(
default_factory=StructuredOutputsConfig
)
Structured outputs configuration.
__post_init__ ¶
Verify configs are valid & consistent with each other.
Source code in vllm/config/vllm.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
|
__str__ ¶
Source code in vllm/config/vllm.py
_get_quantization_config staticmethod
¶
_get_quantization_config(
model_config: ModelConfig, load_config: LoadConfig
) -> Optional[QuantizationConfig]
Get the quantization config.
Source code in vllm/config/vllm.py
_set_cudagraph_sizes ¶
vLLM defines the default candidate list of batch sizes for CUDA graph capture as:
```python max_graph_size = min(max_num_seqs * 2, 512)
1, 2, 4, then multiples of 8 up to max_graph_size¶
cuda_graph_sizes = [1, 2, 4, 8, 16, 24, 32, 40, ..., max_graph_size]
In the end, vllm_config.compilation_config.cudagraph_capture_sizes
will be the final sizes to capture cudagraph (in descending order).
These sizes are used to capture and reuse CUDA graphs for performance-critical paths (e.g., decoding). Capturing enables significantly faster kernel dispatch by avoiding Python overhead. The list is then filtered based on max_num_batched_tokens
(e.g., 8192 on most GPUs), which controls the total allowed number of tokens in a batch. Since each sequence may have a variable number of tokens, the maximum usable batch size will depend on actual sequence lengths.
Example: With max_num_batched_tokens = 8192
, and typical sequences averaging ~32 tokens, most practical batch sizes fall below 256. However, the system will still allow capture sizes up to 512 if shape and memory permit.
Note: If users explicitly specify cudagraph capture sizes in the compilation config, those will override this default logic. At runtime:
- If batch size <= one of the `cudagraph_capture_sizes`, the closest
padded CUDA graph will be used.
- If batch size > largest `cudagraph_capture_sizes`, cudagraph will
not be used.
Source code in vllm/config/vllm.py
compile_debug_dump_path ¶
Returns a rank-aware path for dumping torch.compile debug information.
Source code in vllm/config/vllm.py
compute_hash ¶
compute_hash() -> str
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/vllm.py
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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
get_quantization_config staticmethod
¶
get_quantization_config(
model_config: ModelConfig, load_config: LoadConfig
) -> Optional[QuantizationConfig]
Source code in vllm/config/vllm.py
pad_for_cudagraph ¶
Source code in vllm/config/vllm.py
recalculate_max_model_len ¶
recalculate_max_model_len(max_model_len: int)
Source code in vllm/config/vllm.py
try_verify_and_update_config ¶
Source code in vllm/config/vllm.py
update_sizes_for_sequence_parallelism ¶
Source code in vllm/config/vllm.py
with_hf_config ¶
with_hf_config(
hf_config: PretrainedConfig,
architectures: Optional[list[str]] = None,
) -> VllmConfig
Source code in vllm/config/vllm.py
config ¶
A decorator that ensures all fields in a dataclass have default values and that each field has a docstring.
If a ConfigT
is used as a CLI argument itself, the type
keyword argument provided by get_kwargs
will be pydantic.TypeAdapter(ConfigT).validate_json(cli_arg)
which treats the cli_arg
as a JSON string which gets validated by pydantic
.
Config validation is performed by the tools/validate_config.py script, which is invoked during the pre-commit checks.
Source code in vllm/config/utils.py
get_attr_docs ¶
Get any docstrings placed after attribute assignments in a class body.
https://davidism.com/mit-license/
Source code in vllm/config/utils.py
get_cached_compilation_config cached
¶
get_current_vllm_config ¶
get_current_vllm_config() -> VllmConfig
Source code in vllm/config/vllm.py
get_layers_from_vllm_config ¶
get_layers_from_vllm_config(
vllm_config: VllmConfig,
layer_type: type[T],
layer_names: Optional[list[str]] = None,
) -> dict[str, T]
Get layers from the vLLM config.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vllm_config | VllmConfig | The vLLM config. | required |
layer_type | type[T] | The type of the layer to get. | required |
layer_names | Optional[list[str]] | The names of the layers to get. If None, return all layers. | None |
Source code in vllm/config/vllm.py
is_init_field ¶
is_init_field(cls: ConfigType, name: str) -> bool
iter_architecture_defaults ¶
set_current_vllm_config ¶
set_current_vllm_config(
vllm_config: VllmConfig,
check_compile=False,
prefix: Optional[str] = None,
)
Temporarily set the current vLLM config. Used during model initialization. We save the current vLLM config in a global variable, so that all modules can access it, e.g. custom ops can access the vLLM config to determine how to dispatch.
Source code in vllm/config/vllm.py
try_match_architecture_defaults ¶
try_match_architecture_defaults(
architecture: str,
*,
runner_type: Optional[RunnerType] = None,
convert_type: Optional[ConvertType] = None,
) -> Optional[tuple[str, tuple[RunnerType, ConvertType]]]