{"record":{"id":"c3bb3e3196e974c9","repo":"Comfy-Org/ComfyUI","slug":"unsupported-quantization-format-module-quant-for","errorCode":null,"errorMessage":"Unsupported quantization format: {module.quant_format}","messagePattern":"Unsupported quantization format: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"comfy/ops.py","lineNumber":1225,"sourceCode":"            scale = pop_scale(\"weight_s_rel\")\n            if scale is None:\n                raise ValueError(f\"Missing W4A8 group scale (weight_s_rel) for layer {layer_name}\")\n            if scale.dtype == torch.uint8:\n                scale = scale.view(torch.float8_e4m3fn)\n            params_conf = layer_conf.get(\"params\", {})\n            if not isinstance(params_conf, dict):\n                params_conf = {}\n            scales = {\n                \"scale\": scale,\n                \"s_channel\": pop_scale(\"weight_s_channel\"),\n                \"codebook\": pop_scale(\"weight_codebook\"),\n                \"group_size\": int(layer_conf.get(\"group_size\", params_conf.get(\"group_size\", 16))),\n                \"convrot_groupsize\": int(\n                    layer_conf.get(\"convrot_groupsize\", params_conf.get(\"convrot_groupsize\", 256))\n                ),\n            }\n        else:\n            raise ValueError(f\"Unsupported quantization format: {module.quant_format}\")\n\n        params = layout_cls.Params(**scales, orig_dtype=compute_dtype, orig_shape=module._orig_shape)\n        module.weight = torch.nn.Parameter(\n            QuantizedTensor(weight.to(device=device, dtype=qconfig[\"storage_t\"]), module.layout_type, params),\n            requires_grad=False,\n        )\n\n        if load_extra_params:\n            for param_name in qconfig[\"parameters\"]:\n                if param_name in {\"weight_scale\", \"weight_scale_2\"}:\n                    continue\n                param_key = f\"{prefix}{param_name}\"\n                _v = state_dict.pop(param_key, None)\n                if _v is None:\n                    continue\n                module.register_parameter(param_name, torch.nn.Parameter(_v.to(device=device), requires_grad=False))\n                manually_loaded_keys.append(param_key)\n","sourceCodeStart":1207,"sourceCodeEnd":1243,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ops.py#L1207-L1243","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading or downgrading ComfyUI while reusing quantized checkpoints; community-quantized models using format names the installed version predates; manually editing the comfy_quant payload.","solutions":["Print the comfy_quant JSON for the failing layer (it is embedded in the state dict) to see the exact `format` value.","Update ComfyUI to the version that supports the quantization format (check QUANT_ALGOS keys in comfy/ops.py).","Re-quantize the model with a format supported by your installed version.","If the format is genuinely unsupported on your hardware, convert the checkpoint to a supported format (e.g. dequantize to bf16)."],"exampleFix":"# before: unknown format name in comfy_quant\n{\"format\": \"nvfp4_dequant\", ...}\n\n# after: registered format\n{\"format\": \"nvfp4\", ...}","handlingStrategy":"validation","validationCode":"from comfy.ops import QUANT_ALGOS\nimport json\nfmt = json.loads(sd[layer_prefix + 'comfy_quant'].numpy().tobytes())['format']\nassert fmt in QUANT_ALGOS, f'quant format {fmt!r} not supported by this ComfyUI version'","typeGuard":null,"tryCatchPattern":"try:\n    model_patcher = load_diffusion_model(path)\nexcept ValueError as e:\n    if 'Unsupported quantization format' in str(e):\n        raise SystemExit('checkpoint uses a quantization format unknown to this version; update ComfyUI or re-quantize')\n    raise","preventionTips":["Match quantized checkpoints to the ComfyUI version that produced them.","Check QUANT_ALGOS keys after upgrading to see which formats your build supports."],"tags":["quantization","version-mismatch","checkpoint-loading","config"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}