Skip to content

vllm.model_executor.layers.quantization.online.base

Classes:

OnlineQuantizationConfig

Bases: QuantizationConfig

Model-level config for online quantization (quantize fp16/bf16 weights during model loading, without requiring a pre-quantized checkpoint).

Methods:

_get_method_cls(spec, table, layer_cls)

Resolve the online method class for a layer's quantization spec.

Parameters:

  • spec

    (QuantSpec | None) –

    Quantization specification to resolve.

  • table

    (dict[QuantKey, type]) –

    Mapping from weight quantization keys to method classes.

  • layer_cls

    (type[Module]) –

    Type of the layer that will use the resolved method.

Returns:

  • type | None –

    The matching method class, or None when spec has no weight

  • type | None –

    quantization.

_resolve_targets_quant_method_metadata(prefix, layer_cls)

Resolve target-pattern quantization metadata and dispatch table.

Parameters:

  • prefix

    (str) –

    Fully qualified layer name.

  • layer_cls

    (type[Module]) –

    Type of layer matched against configured target patterns.

Returns:

resolve_quant_method_cls(layer_cls, prefix)

Resolve quantization metadata and method class without instantiating it.

Parameters:

  • layer_cls

    (type[Module]) –

    Type of layer for which to resolve online quantization.

  • prefix

    (str) –

    Fully qualified layer name.

Returns:

OnlineQuantizationSource

Bases: StrEnum

Supported online quantization configuration sources.

_resolved_target(target)

Comparable identity of a quantization_config.targets value.

Returns one (weight, activation, activation was explicit, hadamard_size) tuple per layer kind (linear, MoE), or None for a kind the target does not define: a shorthand name and the equivalent QuantSpec therefore compare equal, while an omitted activation still differs from an explicit null.