vllm.model_executor.layers.quantization.online.base
¶
Classes:
-
OnlineQuantizationConfig–Model-level config for online quantization (quantize fp16/bf16 weights
-
OnlineQuantizationSource–Supported online quantization configuration sources.
OnlineQuantizationConfig
¶
Bases: QuantizationConfig
Model-level config for online quantization (quantize fp16/bf16 weights during model loading, without requiring a pre-quantized checkpoint).
Methods:
-
resolve_quant_method_cls–Resolve quantization metadata and method class without instantiating it.
_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:
_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:
-
tuple[OnlineQuantizationSource, str, str, QuantSpec, dict[QuantKey, type]] | None–A tuple of source, quantization key string, target pattern, spec,
-
tuple[OnlineQuantizationSource, str, str, QuantSpec, dict[QuantKey, type]] | None–and dispatch table. Returns None when no pattern applies or the
-
tuple[OnlineQuantizationSource, str, str, QuantSpec, dict[QuantKey, type]] | None–layer is ignored.
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:
-
tuple[OnlineQuantizationSource, str, str | None, QuantSpec, type] | None–A tuple of source, quantization key string, target pattern, spec
-
tuple[OnlineQuantizationSource, str, str | None, QuantSpec, type] | None–with its resolved activation key, and method class. Returns None
-
tuple[OnlineQuantizationSource, str, str | None, QuantSpec, type] | None–when online quantization does not apply to the layer. The returned
-
tuple[OnlineQuantizationSource, str, str | None, QuantSpec, type] | None–spec's
fields_setis not user input.
_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.