sgl-project/sglang · error · ValueError
The quantization method `{quantization}` is already exists.
Error message
The quantization method `{quantization}` is already exists. What it means
Raised by the register_quantization decorator's _wrapper when attempting to register a quantization method name that already exists in QUANTIZATION_METHODS. The library maintains a registry of quantization method names to prevent duplicate registrations that would silently override configs.
Source
Thrown at python/sglang/multimodal_gen/runtime/layers/quantization/__init__.py:78
"kitchen_int8": KitchenInt8Config,
}
def register_quantization_config(quantization: str):
"""Register a customized vllm quantization config.
When a quantization method is not supported by vllm, you can register a customized
quantization config to support it.
Args:
quantization (str): The quantization method name.
""" # noqa: E501
def _wrapper(quant_config_cls):
if quantization in QUANTIZATION_METHODS:
raise ValueError(
f"The quantization method `{quantization}` is already exists."
)
if not issubclass(quant_config_cls, QuantizationConfig):
raise ValueError(
"The quantization config must be a subclass of " "`QuantizationConfig`."
)
_CUSTOMIZED_METHOD_TO_QUANT_CONFIG[quantization] = quant_config_cls
QUANTIZATION_METHODS.append(quantization)
return quant_config_cls
return _wrapper
def get_quantization_config(quantization: str) -> type[QuantizationConfig]:
if quantization not in QUANTIZATION_METHODS:
raise ValueError(f"Invalid quantization method: {quantization}")
method_to_config: dict[str, type[QuantizationConfig]] = {}View on GitHub (pinned to 0132848349)
Solutions
- Choose a unique name for your custom quantization method and register it again
- If re-registration is expected (e.g. module reload), guard with `if quantization not in QUANTIZATION_METHODS:` before registering
- Check QUANTIZATION_METHODS to see the existing names before picking yours
Example fix
// before
@register_quantization("fp8")
class MyConfig(QuantizationConfig): ...
// after
@register_quantization("my_custom_fp8")
class MyConfig(QuantizationConfig): ... Defensive patterns
Strategy: validation
Validate before calling
from ...quantization import QUANTIZATION_METHODS assert "my_quant" not in QUANTIZATION_METHODS, "name already registered"
Prevention
- Check QUANTIZATION_METHODS before registering
- Use project-prefixed unique method names
- Avoid re-importing registration modules (double registration)
When it happens
Trigger: Calling register_quantization with a name (e.g. "my_quant") that is already in QUANTIZATION_METHODS, e.g. registering a custom method whose name collides with a built-in like "fp8" or registering the same custom method twice.
Common situations: Re-running a notebook/cell that registers a custom quant method; copy-pasting a plugin module that gets imported twice; picking a custom method name that clashes with a built-in method.
Related errors
- scalar_type_id {scalar_type_id} doesn't exists.
- Pipeline '{pipeline_name}' is already registered; pass overw
- Model path '{model_path}' is already registered
- The quantization config must be a subclass of `QuantizationC
- Invalid quantization method: {quantization}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5a437260e007c6ab.
Report an issue: GitHub.