vllm.engine.arg_utils
¶
Classes:
-
AsyncEngineArgs–Arguments for asynchronous vLLM engine.
-
EngineArgs–Arguments for vLLM engine.
Functions:
-
contains_type–Check if the type hints contain a specific type.
-
get_kwargs–Return argparse kwargs for the given Config dataclass.
-
get_type–Get the specific type from the type hints.
-
get_type_hints–Extract type hints from Annotated or Union type hints.
-
is_dict_subclass–Check if the type hint is a subclass of
dict. -
is_not_builtin–Check if the class is not a built-in type.
-
is_type–Check if the type hint is a specific type.
-
literal_to_kwargs–Get the
typeandchoicesfrom aLiteraltype hint intype_hints. -
parse_reasoning_parser–Map
none(any case) to the unset default, asvllm-rs servedoes.
AsyncEngineArgs
dataclass
¶
EngineArgs
dataclass
¶
Arguments for vLLM engine.
Methods:
-
add_cli_args–Shared CLI arguments for vLLM engine.
-
create_engine_config–Create the VllmConfig.
-
create_speculative_config–Initializes and returns a SpeculativeConfig object based on
-
create_structured_outputs_config–Merge frontend parser flags into the structured outputs config.
Attributes:
-
logits_processors(list[str | type[LogitsProcessor]] | None) –Custom logitproc types
-
quantization_config(dict[str, Any] | QuantizationConfigArgs | None) –User-facing quantization configuration. Carries per-layer-kind
logits_processors = ModelConfig.logits_processors
class-attribute
instance-attribute
¶
Custom logitproc types
quantization_config = None
class-attribute
instance-attribute
¶
User-facing quantization configuration. Carries per-layer-kind
QuantSpecs (linear, moe) and ignore patterns; see
QuantizationConfigArgs. Auto-populated from the matching online
shorthand when quantization is one of the values in
ONLINE_QUANT_SHORTHAND_NAMES.
_check_feature_supported()
¶
Raise an error if the feature is not supported.
_get_min_mm_batched_tokens(model_config)
staticmethod
¶
Get the minimum max_num_batched_tokens needed for a multimodal prefix-LM model to process at least one item of any supported modality.
Returns (token_count, modality_name) for the most expensive modality, or None if the value cannot be determined at this stage.
add_cli_args(parser)
staticmethod
¶
Shared CLI arguments for vLLM engine.
create_engine_config(usage_context=None, headless=False)
¶
Create the VllmConfig.
NOTE: If VllmConfig is incompatible, we raise an error.
create_speculative_config(target_model_config, target_parallel_config)
¶
Initializes and returns a SpeculativeConfig object based on
speculative_config.
create_structured_outputs_config()
¶
Merge frontend parser flags into the structured outputs config.
Mutates self.structured_outputs_config in place and returns it
(not a copy). Model-specific defaults (e.g. gpt_oss ->
"openai_gptoss") are applied later by verify_and_update_config
only when the resolved value is still empty, so explicit CLI flags
take precedence.
_expand_json_human_readable_numbers(val)
¶
Expand human-readable number suffixes in a JSON string.
Based on human_readable_int so that the k/m/g/t (decimal) and
K/M/G/T (binary) conventions work out the box.
Also works inside JSON config arguments such
as --kv-transfer-config '{"cpu_bytes_to_use": 80m}'.
Only bare (unquoted) tokens are replaced so that JSON string values
like "model_name" are never modified.
_maybe_add_docs_url(cls)
¶
Generate API docs URL for a vllm config class.
contains_type(type_hints, type)
¶
Check if the type hints contain a specific type.
get_kwargs(cls)
¶
Return argparse kwargs for the given Config dataclass.
If --help or mkdocs are not present in the command line command, the
attribute documentation will not be included in the help output.
The heavy computation is cached via functools.lru_cache, and a deep copy is returned so callers can mutate the dictionary without affecting the cached version.
get_type(type_hints, type)
¶
Get the specific type from the type hints.
get_type_hints(type_hint)
¶
Extract type hints from Annotated or Union type hints.
is_dict_subclass(type_hint)
¶
Check if the type hint is a subclass of dict.
TypedDicts are excluded because they do not support class checks.
is_not_builtin(type_hint)
¶
Check if the class is not a built-in type.
is_type(type_hint, type)
¶
Check if the type hint is a specific type.
literal_to_kwargs(type_hints)
¶
Get the type and choices from a Literal type hint in type_hints.
If type_hints also contains str, we use metavar instead of choices.
parse_reasoning_parser(val)
¶
Map none (any case) to the unset default, as vllm-rs serve does.