{"record":{"id":"9ae33320cc15e6a2","repo":"sgl-project/sglang","slug":"quantconfig-has-static-quantization-but-found-act-9ae333","errorCode":null,"errorMessage":"QuantConfig has static quantization, but found activation scales are None.","messagePattern":"QuantConfig has static quantization, but found activation scales are None\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/quantization/fp8.py","lineNumber":2062,"sourceCode":"                )\n                w2_weight[expert, :, :], layer.w2_weight_scale[expert] = (\n                    scaled_fp8_quant(layer.w2_weight.data[expert, :, :])\n                )\n            layer.w13_weight = torch.nn.Parameter(w13_weight, requires_grad=False)\n            layer.w2_weight = torch.nn.Parameter(w2_weight, requires_grad=False)\n\n            if _is_hip:\n                self.process_weights_hip_scale_padding(layer)\n\n        # If checkpoint is fp8, we need to handle that the\n        # MoE kernels require single activation scale and single weight\n        # scale for w13 per expert.\n        else:\n            # Fp8 moe kernels require a single activation scale.\n            # We take the max of all the scales in case they differ.\n            if self.quant_config.activation_scheme == \"static\":\n                if layer.w13_input_scale is None or layer.w2_input_scale is None:\n                    raise ValueError(\n                        \"QuantConfig has static quantization, but found \"\n                        \"activation scales are None.\"\n                    )\n                if not all_close_1d(layer.w13_input_scale) or not all_close_1d(\n                    layer.w2_input_scale\n                ):\n                    print_warning_once(\n                        \"Found input_scales that are not equal for \"\n                        \"fp8 MoE layer. Using the maximum across experts \"\n                        \"for each layer. \"\n                    )\n                layer.w13_input_scale = torch.nn.Parameter(\n                    layer.w13_input_scale.max(), requires_grad=False\n                )\n                layer.w2_input_scale = torch.nn.Parameter(\n                    layer.w2_input_scale.max(), requires_grad=False\n                )\n","sourceCodeStart":2044,"sourceCodeEnd":2080,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/quantization/fp8.py#L2044-L2080","documentation":"For per-tensor FP8 MoE with static activation scheme, process_weights_after_loading requires w13_input_scale and w2_input_scale to be present; they were expected to be loaded from the checkpoint but are None (missing input_scale keys in the safetensors or weight remapping failed to bind them).","triggerScenarios":"Loading an FP8 MoE model with activation_scheme=\"static\" whose safetensors lack input_scale tensors (or whose weight names don't match the remap table so scales never get bound), then reaching process_weights_after_loading.","commonSituations":"Checkpoints quantized without saving activation scales but with config claiming static; renamed weight keys after fine-tuning/merging; custom checkpoints produced by external quantizers that omit il_scale/input_scale tensors.","solutions":["Use a checkpoint that includes input_scale tensors for the MoE layers (standard FP8 static releases save them)","Switch quantization_config activation_scheme to \"dynamic\" so no static scales are needed","Inspect the safetensors index for missing *input_scale* keys and re-save/quantize with them"],"exampleFix":"// before\n\"quantization_config\": {\"activation_scheme\": \"static\"}  // but no input_scale tensors saved\n// after\n\"quantization_config\": {\"activation_scheme\": \"dynamic\"}","handlingStrategy":"validation","validationCode":"if quant_config.activation_scheme == \"static\":\n    assert layer.w13_input_scale is not None and layer.w2_input_scale is not None, \\\n        \"checkpoint missing MoE input_scale tensors; use dynamic scheme or a complete FP8 checkpoint\"","typeGuard":"def moe_static_scales_present(layer) -> bool:\n    return layer.w13_input_scale is not None and layer.w2_input_scale is not None","tryCatchPattern":"try:\n    method.process_weights_after_loading(layer)\nexcept ValueError as e:\n    if \"activation scales are None\" in str(e):\n        raise SystemExit(\"re-quantize with dynamic scheme or a complete checkpoint\")\n    raise","preventionTips":["Verify safetensors contain *input_scale keys for static FP8 MoE checkpoints","Prefer dynamic activation schemes for custom-quantized models"],"tags":["quantization","fp8","moe","missing-weights","activation-scheme"],"backgroundTag":"missing-quantization-scales","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}