{"record":{"id":"417a12b33ff6f57e","repo":"sgl-project/sglang","slug":"serialized-w4a8-checkpoints-are-not-supported-on-m","errorCode":null,"errorMessage":"Serialized W4A8 checkpoints are not supported on MPS","messagePattern":"Serialized W4A8 checkpoints are not supported on MPS","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/layers/quantization/configs/kitchen_w4a8_config.py","lineNumber":34,"sourceCode":"    QuantizeMethodBase,\n)\nfrom sglang.multimodal_gen.runtime.layers.quantization.kitchen_w4a8 import (\n    KitchenInt8EmbeddingMethod,\n    KitchenW4A8LinearMethod,\n)\nfrom sglang.multimodal_gen.runtime.layers.vocab_parallel_embedding import (\n    VocabParallelEmbedding,\n)\nfrom sglang.multimodal_gen.runtime.platforms import current_platform\n\n\nclass KitchenW4A8Config(QuantizationConfig):\n    \"\"\"Dispatch each linear from its serialized ``asym_w4a8_int8`` marker.\"\"\"\n\n    def __init__(self, layer_markers: dict[str, dict[str, Any]]) -> None:\n        super().__init__()\n        if current_platform.is_mps():\n            raise ValueError(\"Serialized W4A8 checkpoints are not supported on MPS\")\n        if current_platform.is_cuda():\n            capability = current_platform.get_device_capability()\n            if (\n                capability is not None\n                and capability.to_int() < self.get_min_capability()\n            ):\n                raise ValueError(\n                    \"Serialized W4A8 checkpoints require CUDA compute capability \"\n                    f\">= {self.get_min_capability() / 10:.1f}; got \"\n                    f\"{capability.to_int() / 10:.1f}\"\n                )\n        self.layer_markers = layer_markers\n        self.checkpoint_uses_native_qkv_layout = True\n        self.selected: list[str] = []\n\n        for prefix, marker in layer_markers.items():\n            marker_format = marker.get(\"format\")\n            if marker_format == \"int8_tensorwise\" and marker.get(","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/quantization/configs/kitchen_w4a8_config.py#L16-L52","documentation":"KitchenW4A8Config.__init__ raises immediately on MPS: the asym_w4a8_int8 kernels have no Metal backend. This mirrors the W4A4 restriction and fails before any layer construction.","triggerScenarios":"Instantiating KitchenW4A8Config on Apple Silicon with torch device mps.","commonSituations":"Local development on M-series Macs with a W4A8-quantized Comfy checkpoint.","solutions":["Run on a CUDA GPU","Use an MPS-compatible export (int8 or unquantized)"],"exampleFix":"// before\ndevice=\"mps\"\n// after\ndevice=\"cuda\"","handlingStrategy":"type-guard","validationCode":"import torch\nif device == \"mps\" and quant_method == \"kitchen_w4a8\":\n    raise SystemExit(\"W4A8 needs CUDA; pick an int8 export on MPS\")","typeGuard":"def w4a8_supported_here() -> bool:\n    import torch\n    return torch.cuda.is_available()","tryCatchPattern":null,"preventionTips":["Map quant method to required device backend in your model registry"],"tags":["quantization","mps","platform-support","w4a8"],"backgroundTag":"unsupported-platform-operation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}