{"record":{"id":"e12e7abddeb7ca0a","repo":"sgl-project/sglang","slug":"comfyfp8config-must-be-constructed-from-safetensor","errorCode":null,"errorMessage":"ComfyFp8Config must be constructed from safetensors layer markers","messagePattern":"ComfyFp8Config must be constructed from safetensors layer markers","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/layers/quantization/comfy_fp8.py","lineNumber":131,"sourceCode":"    @classmethod\n    def get_name(cls) -> str:\n        return \"comfy_fp8\"\n\n    @classmethod\n    def get_supported_act_dtypes(cls) -> list[torch.dtype]:\n        return Fp8Config.get_supported_act_dtypes()\n\n    @classmethod\n    def get_min_capability(cls) -> int:\n        return Fp8Config.get_min_capability()\n\n    @staticmethod\n    def get_config_filenames() -> list[str]:\n        return []\n\n    @classmethod\n    def from_config(cls, config: dict[str, Any]) -> ComfyFp8Config:\n        raise ValueError(\n            \"ComfyFp8Config must be constructed from safetensors layer markers\"\n        )\n\n    def get_quant_method(\n        self, layer: nn.Module, prefix: str\n    ) -> QuantizeMethodBase | None:\n        if not isinstance(layer, LinearBase):\n            return None\n        marker = self.layer_markers.get(prefix)\n        if marker is None:\n            return UnquantizedLinearMethod()\n        self.selected.append(prefix)\n        if marker.get(\"full_precision_matrix_mult\", False):\n            return ComfyFullPrecisionFp8LinearMethod()\n        activation_scheme = marker.get(\"_activation_scheme\", \"static\")\n        return Fp8LinearMethod(self._fp8_configs[activation_scheme])\n\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/quantization/comfy_fp8.py#L113-L149","documentation":"ComfyFp8Config has no JSON config file; it is constructed directly from safetensors per-layer markers. The inherited from_config classmethod deliberately raises to prevent constructing it from a quant config dict.","triggerScenarios":"Calling ComfyFp8Config.from_config(config_dict) directly or via a generic loading path that reads a config file and calls from_config.","commonSituations":"Generic quant-config loading pipelines that call from_config uniformly for all methods; user code assuming every QuantizationConfig supports dict construction.","solutions":["Construct ComfyFp8Config directly from the layer markers extracted from the safetensors files","Route comfy_fp8 through the marker-based construction path, not the config-file path","Do not list comfy_fp8 in config-filename-driven quantization discovery"],"exampleFix":"// before\ncfg = ComfyFp8Config.from_config({})\n\n// after\ncfg = ComfyFp8Config(layer_markers)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def supports_from_config(cfg_cls) -> bool:\n    return cfg_cls.get_config_filenames() != []","tryCatchPattern":null,"preventionTips":["Never call from_config on configs with empty get_config_filenames()","Route comfy_fp8 through marker-based construction"],"tags":["quantization","fp8","comfy","api-misuse"],"backgroundTag":"invalid-constructor-usage","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}