sgl-project/sglang · error · ValueError

ComfyFp8Config must be constructed from safetensors layer ma

Error message

ComfyFp8Config must be constructed from safetensors layer markers

What it means

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.

Source

Thrown at python/sglang/multimodal_gen/runtime/layers/quantization/comfy_fp8.py:131

    @classmethod
    def get_name(cls) -> str:
        return "comfy_fp8"

    @classmethod
    def get_supported_act_dtypes(cls) -> list[torch.dtype]:
        return Fp8Config.get_supported_act_dtypes()

    @classmethod
    def get_min_capability(cls) -> int:
        return Fp8Config.get_min_capability()

    @staticmethod
    def get_config_filenames() -> list[str]:
        return []

    @classmethod
    def from_config(cls, config: dict[str, Any]) -> ComfyFp8Config:
        raise ValueError(
            "ComfyFp8Config must be constructed from safetensors layer markers"
        )

    def get_quant_method(
        self, layer: nn.Module, prefix: str
    ) -> QuantizeMethodBase | None:
        if not isinstance(layer, LinearBase):
            return None
        marker = self.layer_markers.get(prefix)
        if marker is None:
            return UnquantizedLinearMethod()
        self.selected.append(prefix)
        if marker.get("full_precision_matrix_mult", False):
            return ComfyFullPrecisionFp8LinearMethod()
        activation_scheme = marker.get("_activation_scheme", "static")
        return Fp8LinearMethod(self._fp8_configs[activation_scheme])

View on GitHub (pinned to 0132848349)

Solutions

  1. Construct ComfyFp8Config directly from the layer markers extracted from the safetensors files
  2. Route comfy_fp8 through the marker-based construction path, not the config-file path
  3. Do not list comfy_fp8 in config-filename-driven quantization discovery

Example fix

// before
cfg = ComfyFp8Config.from_config({})

// after
cfg = ComfyFp8Config(layer_markers)
Defensive patterns

Strategy: type-guard

Type guard

def supports_from_config(cfg_cls) -> bool:
    return cfg_cls.get_config_filenames() != []

Prevention

When it happens

Trigger: Calling ComfyFp8Config.from_config(config_dict) directly or via a generic loading path that reads a config file and calls from_config.

Common situations: Generic quant-config loading pipelines that call from_config uniformly for all methods; user code assuming every QuantizationConfig supports dict construction.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/e12e7abddeb7ca0a. Report an issue: GitHub.