Comfy-Org/ComfyUI · error · ValueError
Missing MXFP8 block scales for layer {layer_name}
Error message
Missing MXFP8 block scales for layer {layer_name} What it means
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.
Source
Thrown at comfy/ops.py:1168
module._full_precision_mm_config = layer_conf.get("full_precision_matrix_mult", False)
if not module._full_precision_mm:
module._full_precision_mm = module._full_precision_mm_config
if module.quant_format in disabled_formats:
module._full_precision_mm = True
if module.quant_format is None:
raise ValueError(f"Unknown quantization format for layer {layer_name}")
qconfig = QUANT_ALGOS[module.quant_format]
module.layout_type = qconfig["comfy_tensor_layout"]
layout_cls = get_layout_class(module.layout_type)
# Per-format scales; fp8 dtype views handle both legacy uint8-on-disk and native fp8.
if module.quant_format in ("float8_e4m3fn", "float8_e5m2"):
scales = {"scale": pop_scale("weight_scale")}
elif module.quant_format == "mxfp8":
bs = pop_scale("weight_scale", torch.float8_e8m0fnu)
if bs is None:
raise ValueError(f"Missing MXFP8 block scales for layer {layer_name}")
scales = {"scale": bs}
elif module.quant_format == "nvfp4":
ts = pop_scale("weight_scale_2")
bs = pop_scale("weight_scale", torch.float8_e4m3fn)
if ts is None or bs is None:
raise ValueError(f"Missing NVFP4 scales for layer {layer_name}")
scales = {"scale": ts, "block_scale": bs}
elif module.quant_format == "int8_tensorwise":
scale = pop_scale("weight_scale")
if scale is None:
raise ValueError(f"Missing INT8 weight scale for layer {layer_name}")
scales = {"scale": scale}
params_conf = layer_conf.get("params", {})
if not isinstance(params_conf, dict):
params_conf = {}
if layer_conf.get("convrot", params_conf.get("convrot", False)):
scales["convrot"] = True
scales["convrot_groupsize"] = int(View on GitHub (pinned to 1c6d8d45b3)
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.
Example fix
# before
state_dict = {k: v for k, v in sd.items() if "scale" not in k} # scales stripped
# after
# keep "...weight_scale" entries; mxfp8 requires them
state_dict = sd Defensive patterns
Strategy: try-catch
Validate before calling
if quant_format == "mxfp8" and "weight_scale" not in layer_state_dict:
raise ValueError("mxfp8 layer missing weight_scale; checkpoint is incomplete or nonstandard") Type guard
def has_mxfp8_scales(layer_state_dict) -> bool:
return "weight_scale" in layer_state_dict Try / catch
try:
model = load_mxfp8_checkpoint(path)
except ValueError as e:
if "MXFP8 block scales" in str(e):
raise RuntimeError("mxfp8 scales missing; re-download or re-export with a compliant quantizer") from e
raise Prevention
- Use quantizers that emit the standard weight_scale key for mxfp8.
- Verify checkpoint file sizes/hashes after download before loading.
When it happens
Trigger: 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.
Common situations: Third-party mxfp8 conversions with nonstandard scale key names; checkpoint corruption; quantizer version that names scales differently than the loader expects.
Related errors
- Unknown quantization format for layer {layer_name}
- MXFP8 requires 2D tensor, got {tensor.dim()}D
- Unsupported dtype
- Unexpected token width: {out_x.shape[-1]}
- ar_video sampler requires a Causal-WAN compatible model whos
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/57cbc6221d7b0149.
Report an issue: GitHub.