vllm.model_executor.layers.quantization.petit
PetitFp8KVCacheMethod ¶
Bases: BaseKVCacheMethod
Supports loading kv-cache scaling factors from FP8 checkpoints.
Source code in vllm/model_executor/layers/quantization/petit.py
__init__ ¶
__init__(quant_config: PetitNvFp4Config)
PetitNvFp4Config ¶
Bases: QuantizationConfig
Config class for Petit FP4.
Source code in vllm/model_executor/layers/quantization/petit.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 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 |
|
is_checkpoint_nvfp4_serialized instance-attribute
¶
__init__ ¶
__init__(
is_checkpoint_nvfp4_serialized: bool = False,
kv_cache_quant_algo: Optional[str] = None,
group_size: Optional[int] = None,
exclude_modules: Optional[list[str]] = None,
) -> None
Source code in vllm/model_executor/layers/quantization/petit.py
_check_hardware_support ¶
Verifies that the current hardware is supported by the Petit backend. This backend is specifically designed for AMD GPUs and is not supported on the CUDA platform.
Source code in vllm/model_executor/layers/quantization/petit.py
from_config classmethod
¶
from_config(config: dict[str, Any]) -> PetitNvFp4Config
Source code in vllm/model_executor/layers/quantization/petit.py
get_config_filenames classmethod
¶
get_name classmethod
¶
get_name() -> QuantizationMethods
get_quant_method ¶
get_quant_method(
layer: Module, prefix: str
) -> Optional[QuantizeMethodBase]
Source code in vllm/model_executor/layers/quantization/petit.py
get_scaled_act_names ¶
get_supported_act_dtypes classmethod
¶
is_layer_excluded ¶
Source code in vllm/model_executor/layers/quantization/petit.py
is_petit_nvfp4_compatible classmethod
¶
Source code in vllm/model_executor/layers/quantization/petit.py
override_quantization_method classmethod
¶
override_quantization_method(
hf_quant_cfg, user_quant
) -> Optional[QuantizationMethods]
Source code in vllm/model_executor/layers/quantization/petit.py
require_exclude_modules ¶
PetitNvFp4LinearMethod ¶
Bases: LinearMethodBase
Linear method for NVFP4. Supports loading NVFP4 checkpoints with the following structure:
|Tensor Name | datatype | shape | |----------------------------------------------------| |input_scale | torch.float32 | scalar | |weight | NVFP4(SE2M1) | [1, X, y/2] | |weight_scale | FP8-E4M3 | [X, Y] | |weight_scale_2 | torch.float32 | scalar |
The weights are quantized per block of 16 elements. Args: quant_config: The ModelOpt quantization config.
Source code in vllm/model_executor/layers/quantization/petit.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|
__init__ ¶
__init__(quant_config: PetitNvFp4Config)
apply ¶
Source code in vllm/model_executor/layers/quantization/petit.py
create_weights ¶
create_weights(
layer: Module,
input_size_per_partition: int,
output_partition_sizes: list[int],
input_size: int,
output_size: int,
params_dtype: dtype,
**extra_weight_attrs,
)
Source code in vllm/model_executor/layers/quantization/petit.py
process_weights_after_loading ¶
process_weights_after_loading(layer: Module) -> None