Skip to content

vllm.model_executor.layers.quantization.fp8

Classes:

Fp8Config

Bases: QuantizationConfig

Config class for FP8.

Methods:

get_cache_scale_mapper() staticmethod

Map compressed-tensors KV-cache scale names to vLLM names.

Fp8KVCacheMethod

Bases: BaseKVCacheMethod

Supports loading kv-cache scaling factors from FP8 checkpoints.

Fp8LinearMethod

Bases: LinearMethodBase

Linear method for FP8. Supports loading FP8 checkpoints with static weight scale and dynamic/static activation scale.

Limitations: 1. Only support float8_e4m3fn data type due to the limitation of torch._scaled_mm (https://github.com/pytorch/pytorch/blob/2e48b39603411a41c5025efbe52f89560b827825/aten/src/ATen/native/cuda/Blas.cpp#L854-L856)

Parameters:

  • quant_config

    (Fp8Config) –

    The quantization config.

Fp8MoEMethod

Bases: FusedMoEMethodBase

MoE method for FP8. Supports loading FP8 checkpoints with static weight scale and dynamic/static activation scale.

Also supports loading quantized FP16/BF16 model checkpoints with dynamic activation scaling. The weight scaling factor will be initialized after the model weights are loaded.

Parameters:

  • quant_config

    (Fp8Config) –

    The quantization config.

Methods:

_init_moe_kernel(layer)

Build the MoE kernel from the layer's current (converted) weights.

dequantize_weight(layer)

Yield (experts, w13, w2) dequantized FP8 experts, for online requantization.