sgl-project/sglang · error · ValueError

Config list contains configs from 2 methods, must be only 1

Error message

Config list contains configs from 2 methods, must be only 1

What it means

_verify_quantization collects quantization configs from several sources (HF quantization_config in config.json, checkpoint overrides, etc.) into cfg_list. If more than one non-None source yields a config, the quantization method is ambiguous and sglang raises this error instead of guessing.

Source

Thrown at python/sglang/srt/configs/model_config.py:1572

            "w8a8_fp8": ["compressed-tensors", "compressed_tensors"],
            "auto-round-int8": ["compressed-tensors", "compressed_tensors"],
        }
        if self.quantization is not None:
            self.quantization = self.quantization.lower()

        # Parse quantization method from the HF and ModelSlim model config, if available.
        # Only one function should return config, other should return None.
        cfg_list = []
        hf_config = self._parse_quant_hf_config()
        modelslim_config = self._find_quant_modelslim_config()
        quant_config = modelslim_config or hf_config
        if quant_config is not None:
            cfg_list.append(quant_config)

        # Filter out None values
        cfg_list = [item for item in cfg_list if item is not None]
        if len(cfg_list) > 1:
            raise ValueError(
                "Config list contains configs from 2 methods, must be only 1"
            )
        quant_cfg = cfg_list[0] if cfg_list else None

        if quant_cfg is not None:
            quant_method = quant_cfg.get(
                "quant_method", "" if not self.quantization else self.quantization
            ).lower()

            # ModelOpt FP4 and mixed checkpoints can quantize only the target
            # model; an embedded MTP draft may stay unquantized, so an explicit
            # nvfp4_online opt-in for the draft wins over checkpoint detection.
            # The online loader rejects already-packed weights at load time.
            preserve_online_draft_quantization = (
                self.is_draft_model
                and self.quantization == "nvfp4_online"
                and quant_method in ("modelopt_fp4", "modelopt_mixed")
            )

View on GitHub (pinned to 0132848349)

Solutions

  1. Inspect the model directory's config.json(s) and remove the duplicate quantization_config entries so exactly one source defines quantization
  2. If you intentionally requantize, keep only the checkpoint config and let sglang map it (or clear the stale one)
  3. Re-export the model with a single quantization tool so only one quantization_config block exists

Example fix

// before: config.json contains two quantization_config blocks / plus an override
{
  "quantization_config": {"quant_method": "fp8"},
  "overrides": {"quantization_config": {"quant_method": "awq"}}
}
// after: keep exactly one
{
  "quantization_config": {"quant_method": "fp8"}
}
Defensive patterns

Strategy: validation

Validate before calling

import json
cfg = json.load(open(f"{model_dir}/config.json"))
sources = [k for k in ("quantization_config",) if cfg.get(k)]
# plus any hf_quant_config.json / override files you inject
assert len(sources) <= 1, f"multiple quantization configs: {sources}"

Prevention

When it happens

Trigger: Loading a model whose HF config.json has a quantization_config while another source (e.g. a separate quant_config passed to ModelConfig or an override) also supplies one; ModelConfig.__init__ calls _verify_quantization and len(cfg_list) > 1.

Common situations: Merging quantized checkpoints, editing config.json of an already-quantized model, passing --quantization overrides that materialize as a second config, or using a draft-model setup with mismatched configs.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/7affb77cfbfc1e38. Report an issue: GitHub.