[server] Add --quantization unquant to explicitly opt out of quantization (#21863)
This commit is contained in:
@@ -122,9 +122,10 @@ QUANTIZATION_CHOICES = [
|
|||||||
"compressed-tensors", # for Ktransformers
|
"compressed-tensors", # for Ktransformers
|
||||||
"modelslim", # for NPU
|
"modelslim", # for NPU
|
||||||
"quark_int4fp8_moe",
|
"quark_int4fp8_moe",
|
||||||
|
"unquant",
|
||||||
]
|
]
|
||||||
|
|
||||||
SPECULATIVE_DRAFT_MODEL_QUANTIZATION_CHOICES = [*QUANTIZATION_CHOICES, "unquant"]
|
SPECULATIVE_DRAFT_MODEL_QUANTIZATION_CHOICES = QUANTIZATION_CHOICES
|
||||||
|
|
||||||
ATTENTION_BACKEND_CHOICES = [
|
ATTENTION_BACKEND_CHOICES = [
|
||||||
# Common
|
# Common
|
||||||
@@ -777,6 +778,16 @@ class ServerArgs:
|
|||||||
# Handle deprecated environment variables for prefill delayer.
|
# Handle deprecated environment variables for prefill delayer.
|
||||||
self._handle_prefill_delayer_env_compat()
|
self._handle_prefill_delayer_env_compat()
|
||||||
|
|
||||||
|
# Resolve --quantization unquant: explicitly opt out of quantization.
|
||||||
|
# Convert to None now (before model config validation), but record
|
||||||
|
# the intent so auto-detection in _handle_model_specific_adjustments
|
||||||
|
# does not override it.
|
||||||
|
if self.quantization == "unquant":
|
||||||
|
self.quantization = None
|
||||||
|
self._quantization_explicitly_unset = True
|
||||||
|
else:
|
||||||
|
self._quantization_explicitly_unset = False
|
||||||
|
|
||||||
# Set missing default values.
|
# Set missing default values.
|
||||||
self._handle_missing_default_values()
|
self._handle_missing_default_values()
|
||||||
|
|
||||||
@@ -1692,7 +1703,10 @@ class ServerArgs:
|
|||||||
and weights_cfg.get("strategy") == "group"
|
and weights_cfg.get("strategy") == "group"
|
||||||
and weights_cfg.get("type") == "int"
|
and weights_cfg.get("type") == "int"
|
||||||
)
|
)
|
||||||
if self.quantization is None:
|
if (
|
||||||
|
self.quantization is None
|
||||||
|
and not self._quantization_explicitly_unset
|
||||||
|
):
|
||||||
# Default DeepSeek V3/R1 native FP8 when not explicitly set,
|
# Default DeepSeek V3/R1 native FP8 when not explicitly set,
|
||||||
# Because we need this condition for an assertion in
|
# Because we need this condition for an assertion in
|
||||||
# flashinfer_trtllm MoE runner backend.
|
# flashinfer_trtllm MoE runner backend.
|
||||||
@@ -2027,7 +2041,11 @@ class ServerArgs:
|
|||||||
]:
|
]:
|
||||||
if is_sm100_supported():
|
if is_sm100_supported():
|
||||||
quant_method = get_quantization_config(hf_config)
|
quant_method = get_quantization_config(hf_config)
|
||||||
if self.quantization is None and quant_method is not None:
|
if (
|
||||||
|
self.quantization is None
|
||||||
|
and not self._quantization_explicitly_unset
|
||||||
|
and quant_method is not None
|
||||||
|
):
|
||||||
self.quantization = quant_method
|
self.quantization = quant_method
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
@@ -2081,7 +2099,11 @@ class ServerArgs:
|
|||||||
if quantization_config is not None
|
if quantization_config is not None
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
if self.quantization is None and quant_method is not None:
|
if (
|
||||||
|
self.quantization is None
|
||||||
|
and not self._quantization_explicitly_unset
|
||||||
|
and quant_method is not None
|
||||||
|
):
|
||||||
self.quantization = quant_method
|
self.quantization = quant_method
|
||||||
if (
|
if (
|
||||||
self.quantization == "modelopt_fp4"
|
self.quantization == "modelopt_fp4"
|
||||||
|
|||||||
Reference in New Issue
Block a user