{"record":{"id":"57cbc6221d7b0149","repo":"Comfy-Org/ComfyUI","slug":"missing-mxfp8-block-scales-for-layer-layer-name","errorCode":null,"errorMessage":"Missing MXFP8 block scales for layer {layer_name}","messagePattern":"Missing MXFP8 block scales for layer (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ops.py","lineNumber":1168,"sourceCode":"        module._full_precision_mm_config = layer_conf.get(\"full_precision_matrix_mult\", False)\n        if not module._full_precision_mm:\n            module._full_precision_mm = module._full_precision_mm_config\n        if module.quant_format in disabled_formats:\n            module._full_precision_mm = True\n        if module.quant_format is None:\n            raise ValueError(f\"Unknown quantization format for layer {layer_name}\")\n\n        qconfig = QUANT_ALGOS[module.quant_format]\n        module.layout_type = qconfig[\"comfy_tensor_layout\"]\n        layout_cls = get_layout_class(module.layout_type)\n\n        # Per-format scales; fp8 dtype views handle both legacy uint8-on-disk and native fp8.\n        if module.quant_format in (\"float8_e4m3fn\", \"float8_e5m2\"):\n            scales = {\"scale\": pop_scale(\"weight_scale\")}\n        elif module.quant_format == \"mxfp8\":\n            bs = pop_scale(\"weight_scale\", torch.float8_e8m0fnu)\n            if bs is None:\n                raise ValueError(f\"Missing MXFP8 block scales for layer {layer_name}\")\n            scales = {\"scale\": bs}\n        elif module.quant_format == \"nvfp4\":\n            ts = pop_scale(\"weight_scale_2\")\n            bs = pop_scale(\"weight_scale\", torch.float8_e4m3fn)\n            if ts is None or bs is None:\n                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(","sourceCodeStart":1150,"sourceCodeEnd":1186,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ops.py#L1150-L1186","documentation":"For mxfp8-quantized layers the loader requires a block-scale tensor (weight_scale in float8_e8m0fnu) alongside the weights; MXFP8 encoding is meaningless without per-block exponents. pop_scale returning None means the scale tensor is missing from the state dict, and the loader fails fast with the layer name rather than computing garbage.","triggerScenarios":"Loading an mxfp8 layer whose state dict lacks the weight_scale entry — e.g. a converter that emitted scales under a different key, stripped them, or a truncated download.","commonSituations":"Third-party mxfp8 conversions with nonstandard scale key names; checkpoint corruption; quantizer version that names scales differently than the loader expects.","solutions":["Re-download or re-export the checkpoint with a converter that emits the standard weight_scale for mxfp8.","If the scales exist under another key, rename them to weight_scale in the state dict.","Use a supported fp8/int8/nvfp4 variant if mxfp8 conversion keeps failing."],"exampleFix":"# before\nstate_dict = {k: v for k, v in sd.items() if \"scale\" not in k}  # scales stripped\n# after\n# keep \"...weight_scale\" entries; mxfp8 requires them\nstate_dict = sd","handlingStrategy":"try-catch","validationCode":"if quant_format == \"mxfp8\" and \"weight_scale\" not in layer_state_dict:\n    raise ValueError(\"mxfp8 layer missing weight_scale; checkpoint is incomplete or nonstandard\")","typeGuard":"def has_mxfp8_scales(layer_state_dict) -> bool:\n    return \"weight_scale\" in layer_state_dict","tryCatchPattern":"try:\n    model = load_mxfp8_checkpoint(path)\nexcept ValueError as e:\n    if \"MXFP8 block scales\" in str(e):\n        raise RuntimeError(\"mxfp8 scales missing; re-download or re-export with a compliant quantizer\") from e\n    raise","preventionTips":["Use quantizers that emit the standard weight_scale key for mxfp8.","Verify checkpoint file sizes/hashes after download before loading."],"tags":["quantization","mxfp8","scales","checkpoint"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}