sgl-project/sglang · error · ValueError
Unsupported activation scheme {activation_scheme}
Error message
Unsupported activation scheme {activation_scheme} What it means
The Fp8LinearConfig constructor validates activation_scheme against the ACTIVATION_SCHEMES whitelist ('static' and 'dynamic'). Any other string — including 'none', 'None' handled elsewhere, typos, or new scheme names — raises this ValueError at config construction time, before weights are created.
Source
Thrown at python/sglang/srt/layers/quantization/fp8.py:248
is_checkpoint_fp8_serialized: bool = False,
activation_scheme: str = "dynamic",
ignored_layers: Optional[List[str]] = None,
weight_block_size: List[int] = None,
packed_modules_mapping: Optional[Dict[str, List[str]]] = None,
use_mxfp8: bool = False,
is_fp4_experts: bool = False,
kv_cache_quant_algo: Optional[str] = None,
) -> None:
super().__init__()
# DSV4 mxfp4-packed (True) vs converted FP8 (False); injected by
# model_loader from ModelConfig. Default False off the DSV4 path.
self.is_fp4_experts = is_fp4_experts
self.dequant_fp4_to_fp8 = False
self.is_checkpoint_fp8_serialized = is_checkpoint_fp8_serialized
if is_checkpoint_fp8_serialized:
log_info_on_rank0(logger, "Detected fp8 checkpoint.")
if activation_scheme not in ACTIVATION_SCHEMES:
raise ValueError(f"Unsupported activation scheme {activation_scheme}")
self.activation_scheme = activation_scheme
self.ignored_layers = ignored_layers or []
if ignored_layers_str := envs.SGLANG_FP8_IGNORED_LAYERS.get():
self.ignored_layers.extend(
[
layer.strip()
for layer in ignored_layers_str.split(",")
if layer.strip()
]
)
self.packed_modules_mapping = packed_modules_mapping or {}
self.use_mxfp8 = use_mxfp8
self.kv_cache_quant_algo = kv_cache_quant_algo
if weight_block_size is not None:
if not is_checkpoint_fp8_serialized:
raise ValueError(
"The block-wise quantization only supports fp8-serialized checkpoint for now."
)View on GitHub (pinned to 0132848349)
Solutions
- Set activation_scheme to "static" or "dynamic" in the model's config.json quantization_config
- If the checkpoint truly uses a per-token scheme, map it to "dynamic" which covers per-token dynamic quantization
- Check for trailing whitespace/case issues in the config value
Example fix
// before
"quantization_config": { "quant_method": "fp8", "activation_scheme": "static_per_token" }
// after
"quantization_config": { "quant_method": "fp8", "activation_scheme": "dynamic" } Defensive patterns
Strategy: validation
Validate before calling
from sglang.srt.layers.quantization.fp8 import Fp8LinearConfig # ACTIVATION_SCHEMES lives in config module
scheme = qcfg.get("activation_scheme", "dynamic")
if scheme not in ("static", "dynamic"):
qcfg["activation_scheme"] = "dynamic" # or hard-fail with a clear message Type guard
def is_valid_activation_scheme(s: str) -> bool:
return s in {"static", "dynamic"} Try / catch
try:
cfg = Fp8LinearConfig(...)
except ValueError as e:
if "activation scheme" in str(e):
cfg = Fp8LinearConfig(..., activation_scheme="dynamic")
else:
raise Prevention
- Normalize activation_scheme to static/dynamic when ingesting third-party checkpoints
- Schema-validate quantization_config before model load
- Fail fast in data pipelines writing quant configs
When it happens
Trigger: Constructing Fp8LinearConfig(activation_scheme=...) with a value outside ACTIVATION_SCHEMES; usually triggered by parsing a checkpoint's quantization_config where activation_scheme is something like "static_per_token", "" (empty), or miscapitalized "Dynamic".
Common situations: Fine-tuned checkpoints saved with custom quant tools that write non-standard activation_scheme values; hand-edited config.json quantization sections; schemas that use "delayed" or other schemes SGLang hasn't mapped.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- The hpc_ops MoE runner backend only supports FP8-quantized M
- The block-wise quantization only supports fp8-serialized che
- The quantization block size of weight must have 2 dimensions
- Found static activation scheme for checkpoint that was not s
- FP8 weight_block_size must contain two positive integers, go
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/64710ddf13640a8c.
Report an issue: GitHub.