vllm.config.quantization ¶
Classes:
-
QuantSpec–Quantization spec for one layer kind (linear or MoE).
-
QuantizationConfigArgs–User-facing quantization configuration.
Functions:
-
resolve_quantization_config–Resolve
--quantizationshorthand and--quantization-configinto a
QuantSpec ¶
Quantization spec for one layer kind (linear or MoE).
None on either side means the method class falls back to its own default (typically inherited from the checkpoint, or unquantized for online).
Attributes:
-
activation(QuantKeyField) –Activation quantization key, or a name from QUANT_KEY_NAMES.
-
weight(QuantKeyField) –Weight quantization key, or a name from QUANT_KEY_NAMES.
Source code in vllm/config/quantization.py
QuantizationConfigArgs ¶
User-facing quantization configuration.
See docs/features/quantization/online.md for the schema and shorthand string forms accepted on linear and moe.
Attributes:
-
ignore(list[str]) –Layers to skip quantization for. Online quantization also supports
-
linear(QuantSpec | None) –Spec applied to
LinearBaselayers. -
moe(QuantSpec | None) –Spec applied to
FusedMoEFactorylayers. -
targets(dict[str, str] | None) –Per-layer online quantization overrides, keyed by exact layer name or
Source code in vllm/config/quantization.py
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 | |
ignore = Field(default_factory=list) class-attribute instance-attribute ¶
Layers to skip quantization for. Online quantization also supports fnmatch-style patterns.
linear = None class-attribute instance-attribute ¶
Spec applied to LinearBase layers.
moe = None class-attribute instance-attribute ¶
Spec applied to FusedMoEFactory layers.
targets = None class-attribute instance-attribute ¶
Per-layer online quantization overrides, keyed by exact layer name or regex patterns with a re:, or fnmatch-style patterns for online quantization, mapping to an online shorthand name (see _ONLINE_SHORTHANDS). A layer that matches no pattern is left unquantized. Mutually exclusive with linear and moe.
resolve_quantization_config(quantization, quantization_config) ¶
Resolve --quantization shorthand and --quantization-config into a QuantizationConfigArgs.
quantization is a CLI shorthand that desugars into a base config via _ONLINE_SHORTHANDS. quantization_config is a dict or pre-built args object. When both are given, fields explicitly set in quantization_config take precedence over the shorthand.