Skip to content

vllm.model_executor.layers.quantization.utils.config_utils

Functions:

_get_effective_quant_keys(quant_config, prefix, layer_type)

Return the (weight, activation) keys a layer runs with: its online quantization target if any, else its checkpoint format. None denotes an unquantized weight, or an unknown/unquantized activation.

Raises:

find_matching_patterns(layer_name, patterns, fused_mapping=MappingProxyType({}), use_fnmatch=False)

Return matching patterns for a layer or each shard of a fused layer.

A pattern matching the fused layer directly takes precedence. Otherwise, return one set of matching patterns for every shard.

get_checkpoint_quant_keys(quant_config, prefix, layer_type)

Return the (weight, activation) keys a layer is stored with in the checkpoint. None denotes an unquantized weight, or an unknown/unquantized activation.

Raises:

get_layer_name_after_index(layer_name)

Return the suffix following the final numeric component of a layer name.

get_quark_ocp_mx_group_size(quant_config, layer_name)

Return the OCP MX group size for a quantized Quark linear layer.

is_equal_or_regex_match(value, target, check_contains=False, use_fnmatch=False)

Checks whether a value is exactly equal or a regex match for target if target starts with 're:'. If check_contains is set to True, additionally checks if the target string is contained within the value. If use_fnmatch is set, supports shell-style patterns in target.

is_shared_expert_quant_fse_compatible(quant_config, expert_prefix, shared_expert_prefix, projection_names=None, moe_backend=None)

Check whether quantization permits fused shared-expert execution.

Parameters:

  • quant_config

    (QuantizationConfig | None) –

    Model quantization configuration.

  • expert_prefix

    (str) –

    Routed-expert module prefix.

  • shared_expert_prefix

    (str) –

    Shared-expert module prefix.

  • projection_names

    (list[str] | None, default: None ) –

    Shared-expert projection names.

  • moe_backend

    (str | None, default: None ) –

    MoE backend that runs the fused shared expert.

Returns:

  • tuple[bool, str | None] –

    A compatibility flag and, when incompatible, the reason.