{"record":{"id":"918f762a11ef3cc8","repo":"Comfy-Org/ComfyUI","slug":"missing-convrot-w4a4-weight-scale-for-layer-layer","errorCode":null,"errorMessage":"Missing ConvRot W4A4 weight scale for layer {layer_name}","messagePattern":"Missing ConvRot W4A4 weight scale for layer (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"comfy/ops.py","lineNumber":1192,"sourceCode":"                raise ValueError(f\"Missing NVFP4 scales for layer {layer_name}\")\n            scales = {\"scale\": ts, \"block_scale\": bs}\n        elif module.quant_format == \"int8_tensorwise\":\n            scale = pop_scale(\"weight_scale\")\n            if scale is None:\n                raise ValueError(f\"Missing INT8 weight scale for layer {layer_name}\")\n            scales = {\"scale\": scale}\n            params_conf = layer_conf.get(\"params\", {})\n            if not isinstance(params_conf, dict):\n                params_conf = {}\n            if layer_conf.get(\"convrot\", params_conf.get(\"convrot\", False)):\n                scales[\"convrot\"] = True\n                scales[\"convrot_groupsize\"] = int(\n                    layer_conf.get(\"convrot_groupsize\", params_conf.get(\"convrot_groupsize\", 256))\n                )\n        elif module.quant_format == \"convrot_w4a4\":\n            scale = pop_scale(\"weight_scale\")\n            if scale is None:\n                raise ValueError(f\"Missing ConvRot W4A4 weight scale for layer {layer_name}\")\n            params_conf = layer_conf.get(\"params\", {})\n            if not isinstance(params_conf, dict):\n                params_conf = {}\n            scales = {\n                \"scale\": scale,\n                \"convrot_groupsize\": int(\n                    layer_conf.get(\"convrot_groupsize\", params_conf.get(\"convrot_groupsize\", 256))\n                ),\n                \"quant_group_size\": 64,\n                \"linear_dtype\": layer_conf.get(\"linear_dtype\", params_conf.get(\"linear_dtype\", \"int4\")),\n            }\n        elif module.quant_format == \"asym_w4a8_int8\":\n            # int4 weight (packed int8 [N,K/2]) + fp8 per-group scale (weight_s_rel),\n            # fp32 per-channel scale (weight_s_channel) + optional Lloyd-Max codebook.\n            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:","sourceCodeStart":1174,"sourceCodeEnd":1210,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ops.py#L1174-L1210","documentation":"Raised in comfy/ops.py when a layer's `comfy_quant` metadata specifies quant_format 'convrot_w4a4' but the state dict has no `weight_scale` for that layer. The ConvRot W4A4 format (4-bit weights, 4-bit activations with rotation) needs the weight scale plus a convrot_groupsize to be usable; the loader refuses to continue without it.","triggerScenarios":"Loading a convrot_w4a4-quantized checkpoint whose `weight_scale` keys are absent under the layer prefix; conversion scripts that emit the comfy_quant blob but skip scale tensors; prefix mismatches after key remapping.","commonSituations":"Models quantized with experimental ConvRot W4A4 tooling that is out of sync with the loader's expected key layout; partial or hand-merged checkpoints; renames during model surgery that break prefix alignment between comfy_quant and weight_scale.","solutions":["Check the checkpoint for `<prefix>.weight_scale` next to the failing layer named in the message.","Re-quantize using the ComfyUI convrot_w4a4 quantization path so scales and groupsize config are emitted together.","Verify no key-remapping/merging step stripped scale tensors before load.","Fall back to a supported format (int8_tensorwise, fp8) if the ConvRot scales cannot be regenerated."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"prefix = failing_layer_prefix  # from the error message\nassert (prefix + 'weight_scale') in sd, f'{prefix}weight_scale missing for convrot_w4a4 layer'","typeGuard":null,"tryCatchPattern":"try:\n    model_patcher = load_diffusion_model(path)\nexcept ValueError as e:\n    if 'ConvRot W4A4' in str(e):\n        raise SystemExit('convrot_w4a4 checkpoint is missing scale tensors; re-quantize')\n    raise","preventionTips":["Keep the quantizer and loader on the same ComfyUI version for experimental formats like convrot_w4a4.","Validate that every comfy_quant-bearing layer also has its scale keys before shipping a checkpoint."],"tags":["quantization","w4a4","convrot","checkpoint-loading"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}