vllm.model_executor.layers.quantization.quark.quark
¶
Classes:
QuarkConfig
¶
Bases: QuantizationConfig
Methods:
-
apply_vllm_mapper–Interface for models to update module names referenced in
-
get_cache_scale_mapper–Map Quark KV-cache scale names to vLLM names.
-
get_quant_method_target–Return weight key, activation key, and quant method class for
-
get_scheme_cls–Return quantization keys and scheme class without initializing it.
-
init_scheme–Construct a Quark scheme selected by get_scheme_cls.
-
maybe_update_config–Find the linear layers exported with an online input rotation.
_is_w_ocp_mx_a_x(weight_quant, input_quant, allow_static_fp8=False)
¶
This check returns True only if it is an OCP-MX weight quantization. The activation can be FP16/BF16, OCP MXFP4, MXFP8, FP8. The rationale for checking only the weight type is that the model loading concept and process primarily concerns the weights themselves.
_scale_block_rows(prefix, layer_type)
¶
How many weight rows one checkpoint scale row covers.
1 for the canonical 1-D per-group MX spelling; block_size[0] for
MXFP8 exports that spell the scale 2-D (DeepSeek-V4.1 uses 32). The
scheme cannot work this out itself: it has no handle on the layer name,
and tensor-parallel sharding narrows the loaded scale so the ratio is
not recoverable from shapes either.
_unwrap_single_quant_config(quant_config)
staticmethod
¶
Unwrap one-entry quantization-config lists.
apply_vllm_mapper(hf_to_vllm_mapper)
¶
Interface for models to update module names referenced in quantization configs in order to reflect the vllm model structure
Parameters:
-
(hf_to_vllm_mapper¶WeightsMapper) –maps from hf model structure (the assumed structure of the qconfig) to vllm model structure
get_cache_scale_mapper()
staticmethod
¶
Map Quark KV-cache scale names to vLLM names.
get_quant_method_target(prefix, layer_type)
¶
Return weight key, activation key, and quant method class for
the given prefix and layer_type.
This is the counterpart of get_quant_method without quant method
instantiation.
TODO: integrate as part of base QuantizationConfig.get_quant_method_target in the future.
None denotes an unquantized/BF16 activation.
get_scheme_cls(layer_type, layer_name)
¶
Return quantization keys and scheme class without initializing it.
init_scheme(scheme_cls, weight_quant_key, activation_quant_key, scale_block_rows=1, weight_config=None)
¶
Construct a Quark scheme selected by get_scheme_cls.
maybe_update_config(model_name, hf_config=None, revision=None)
¶
Find the linear layers exported with an online input rotation.
Quark's RotationConfig with online_r1_rotation (or r4)
keeps the activation rotation online: the weight is stored rotated
along its input dimension, and the layer carries an input_rotation
tensor (a +-1 int8 Hadamard matrix of size rotation_size) that the
activation must be multiplied by first.
QuarkKVCacheMethod
¶
Bases: BaseKVCacheMethod
Supports loading kv-cache scaling factors from quark checkpoints.
Methods:
-
validate_kv_cache_config–Validator for the kv cache configuration. Useful for controlling the
QuarkLinearMethod
¶
Bases: LinearMethodBase, InputHadamardFusable
Methods:
-
apply–Use the output of create_weights and the CompressedTensorsScheme
-
create_weights–Use the CompressedTensorsScheme associated with each layer to create
-
dequantize_weight–Reconstruct serialized weights for online requantization.
apply(layer, x, bias=None)
¶
Use the output of create_weights and the CompressedTensorsScheme associated with the layer to apply the forward pass with the layer input. See LinearMethodBase for param details
create_weights(layer, input_size_per_partition, output_partition_sizes, input_size, output_size, params_dtype, **extra_weight_attrs)
¶
Use the CompressedTensorsScheme associated with each layer to create the necessary parameters for the layer. See LinearMethodBase for param details
dequantize_weight(layer)
¶
Reconstruct serialized weights for online requantization.