sgl-project/sglang · error · ValueError
FP8 weight_block_size must contain two positive integers, go
Error message
FP8 weight_block_size must contain two positive integers, got {schema.weight_block_size!r}. What it means
The Humming FP8 config constructor validates schema.weight_block_size: after conversion to a tuple it must contain exactly two entries, each a strict positive int (bools are explicitly rejected). Any malformed value (wrong length, floats, strings, negatives, zero, or True/False) raises this error at init.
Source
Thrown at python/sglang/srt/layers/quantization/humming.py:319
output_tensors = {
"weight": weight.contiguous().view(torch.int32),
"weight_scale": tensors["weight_scale_inv"].to(param_dtype),
}
if "bias" in tensors:
output_tensors["bias"] = tensors["bias"]
return schema, output_tensors
class _StackedBlockFp8CheckpointWeightSchema(_CheckpointWeightSchema):
def __init__(self, schema):
self.schema = schema
self.quant_method = schema.quant_method
weight_block_size = tuple(schema.weight_block_size)
if len(weight_block_size) != 2 or any(
not isinstance(size, int) or isinstance(size, bool) or size <= 0
for size in weight_block_size
):
raise ValueError(
"FP8 weight_block_size must contain two positive integers, "
f"got {schema.weight_block_size!r}."
)
self.weight_block_size = weight_block_size
self.weight_scale_key = schema.weight_scale_key
def get_tensors_attrs(
self,
shape_n: int,
shape_k: int,
param_dtype: torch.dtype,
num_experts: int | None = None,
has_bias: bool = False,
stack_size: int = 1,
) -> dict[str, dict[str, Any]]:
tensors_attrs = self.schema.get_tensors_attrs(
shape_n=shape_n,
shape_k=shape_k,View on GitHub (pinned to 0132848349)
Solutions
- Set weight_block_size to a two-element list of positive integers, e.g. [128, 128]
- If the field came from a converted checkpoint, re-run conversion or restore the original config.json
- Validate the schema programmatically before server launch (see validationCode)
Example fix
// config.json (before)
"quantization_config": { "weight_block_size": [128] }
// config.json (after)
"quantization_config": { "weight_block_size": [128, 128] } Defensive patterns
Strategy: type-guard
Validate before calling
wbs = cfg.quantization_config.get("weight_block_size")
assert isinstance(wbs, (list, tuple)) and len(wbs) == 2 and all(isinstance(x, int) and not isinstance(x, bool) and x > 0 for x in wbs), "bad weight_block_size" Type guard
def is_valid_block_size(w) -> bool:
return (isinstance(w, (list, tuple)) and len(w) == 2
and all(isinstance(x, int) and not isinstance(x, bool) and x > 0 for x in w)) Prevention
- Never hand-edit weight_block_size; keep the original quantization_config
- Add a config lint step before server launch
When it happens
Trigger: Passing a quantization config JSON whose weight_block_size is e.g. [128], [128, 128, 128], [128.0, 128.0], "128x128", or [true, false]; loading a hand-edited or auto-converted HF quantization_config where the field was dropped or stringified.
Common situations: Hand-editing config.json quantization sections; converting checkpoints between formats that serialize block size as a string; copying an FP8 config template and truncating the block-size list.
Related errors
- The hpc_ops MoE runner backend only supports FP8-quantized M
- Unsupported activation scheme {activation_scheme}
- The quantization block size of weight must have 2 dimensions
- W4AFP8 group_size must be a positive integer, got {group_siz
- kv_scales supplied but unified_kv is {unified_kv.dtype}, exp
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5c9a4fd039e60fcf.
Report an issue: GitHub.