{"record":{"id":"5c9a4fd039e60fcf","repo":"sgl-project/sglang","slug":"fp8-weight-block-size-must-contain-two-positive-in","errorCode":null,"errorMessage":"FP8 weight_block_size must contain two positive integers, got {schema.weight_block_size!r}.","messagePattern":"FP8 weight_block_size must contain two positive integers, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/quantization/humming.py","lineNumber":319,"sourceCode":"        output_tensors = {\n            \"weight\": weight.contiguous().view(torch.int32),\n            \"weight_scale\": tensors[\"weight_scale_inv\"].to(param_dtype),\n        }\n        if \"bias\" in tensors:\n            output_tensors[\"bias\"] = tensors[\"bias\"]\n        return schema, output_tensors\n\n\nclass _StackedBlockFp8CheckpointWeightSchema(_CheckpointWeightSchema):\n    def __init__(self, schema):\n        self.schema = schema\n        self.quant_method = schema.quant_method\n        weight_block_size = tuple(schema.weight_block_size)\n        if len(weight_block_size) != 2 or any(\n            not isinstance(size, int) or isinstance(size, bool) or size <= 0\n            for size in weight_block_size\n        ):\n            raise ValueError(\n                \"FP8 weight_block_size must contain two positive integers, \"\n                f\"got {schema.weight_block_size!r}.\"\n            )\n        self.weight_block_size = weight_block_size\n        self.weight_scale_key = schema.weight_scale_key\n\n    def get_tensors_attrs(\n        self,\n        shape_n: int,\n        shape_k: int,\n        param_dtype: torch.dtype,\n        num_experts: int | None = None,\n        has_bias: bool = False,\n        stack_size: int = 1,\n    ) -> dict[str, dict[str, Any]]:\n        tensors_attrs = self.schema.get_tensors_attrs(\n            shape_n=shape_n,\n            shape_k=shape_k,","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/quantization/humming.py#L301-L337","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"// config.json (before)\n\"quantization_config\": { \"weight_block_size\": [128] }\n// config.json (after)\n\"quantization_config\": { \"weight_block_size\": [128, 128] }","handlingStrategy":"type-guard","validationCode":"wbs = cfg.quantization_config.get(\"weight_block_size\")\nassert 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\"","typeGuard":"def is_valid_block_size(w) -> bool:\n    return (isinstance(w, (list, tuple)) and len(w) == 2\n            and all(isinstance(x, int) and not isinstance(x, bool) and x > 0 for x in w))","tryCatchPattern":null,"preventionTips":["Never hand-edit weight_block_size; keep the original quantization_config","Add a config lint step before server launch"],"tags":["quantization","fp8","config-validation","humming"],"backgroundTag":"invalid-quantization-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}