Comfy-Org/ComfyUI · critical · ValueError

Unsupported quantization format: {module.quant_format}

Error message

Unsupported quantization format: {module.quant_format}

What it means

Raised in comfy/ops.py when a layer's `comfy_quant` metadata carries a `format` string that is not one of the formats registered in QUANT_ALGOS (float8_e4m3fn, float8_e5m2, mxfp8, nvfp4, int8_tensorwise, convrot_w4a4, asym_w4a8_int8, ...). The loader dispatches strictly on that string, so an unknown format aborts model loading.

Source

Thrown at comfy/ops.py:1225

            scale = pop_scale("weight_s_rel")
            if scale is None:
                raise ValueError(f"Missing W4A8 group scale (weight_s_rel) for layer {layer_name}")
            if scale.dtype == torch.uint8:
                scale = scale.view(torch.float8_e4m3fn)
            params_conf = layer_conf.get("params", {})
            if not isinstance(params_conf, dict):
                params_conf = {}
            scales = {
                "scale": scale,
                "s_channel": pop_scale("weight_s_channel"),
                "codebook": pop_scale("weight_codebook"),
                "group_size": int(layer_conf.get("group_size", params_conf.get("group_size", 16))),
                "convrot_groupsize": int(
                    layer_conf.get("convrot_groupsize", params_conf.get("convrot_groupsize", 256))
                ),
            }
        else:
            raise ValueError(f"Unsupported quantization format: {module.quant_format}")

        params = layout_cls.Params(**scales, orig_dtype=compute_dtype, orig_shape=module._orig_shape)
        module.weight = torch.nn.Parameter(
            QuantizedTensor(weight.to(device=device, dtype=qconfig["storage_t"]), module.layout_type, params),
            requires_grad=False,
        )

        if load_extra_params:
            for param_name in qconfig["parameters"]:
                if param_name in {"weight_scale", "weight_scale_2"}:
                    continue
                param_key = f"{prefix}{param_name}"
                _v = state_dict.pop(param_key, None)
                if _v is None:
                    continue
                module.register_parameter(param_name, torch.nn.Parameter(_v.to(device=device), requires_grad=False))
                manually_loaded_keys.append(param_key)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Print the comfy_quant JSON for the failing layer (it is embedded in the state dict) to see the exact `format` value.
  2. Update ComfyUI to the version that supports the quantization format (check QUANT_ALGOS keys in comfy/ops.py).
  3. Re-quantize the model with a format supported by your installed version.
  4. If the format is genuinely unsupported on your hardware, convert the checkpoint to a supported format (e.g. dequantize to bf16).

Example fix

# before: unknown format name in comfy_quant
{"format": "nvfp4_dequant", ...}

# after: registered format
{"format": "nvfp4", ...}
Defensive patterns

Strategy: validation

Validate before calling

from comfy.ops import QUANT_ALGOS
import json
fmt = json.loads(sd[layer_prefix + 'comfy_quant'].numpy().tobytes())['format']
assert fmt in QUANT_ALGOS, f'quant format {fmt!r} not supported by this ComfyUI version'

Try / catch

try:
    model_patcher = load_diffusion_model(path)
except ValueError as e:
    if 'Unsupported quantization format' in str(e):
        raise SystemExit('checkpoint uses a quantization format unknown to this version; update ComfyUI or re-quantize')
    raise

Prevention

When it happens

Trigger: A quantized checkpoint written by a newer ComfyUI version with formats this version does not know; a typo or changed format name inside the comfy_quant JSON; hand-crafted comfy_quant blobs; quantizer/library version mismatch between producer and consumer.

Common situations: Upgrading or downgrading ComfyUI while reusing quantized checkpoints; community-quantized models using format names the installed version predates; manually editing the comfy_quant payload.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/c3bb3e3196e974c9. Report an issue: GitHub.