From 3831e4563fe5e07ea102be3b5a6b648093ef36c2 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Sat, 11 Jul 2026 02:03:10 +0100 Subject: [PATCH] feat(model): variant-specific fp8 precision tokens fp8_e4m3fn and fp8_e5m2 differ in kernel support, so a bare fp8 token is not enough to know whether a file runs on a given architecture; scaled_fp8 derives its token from the detected format. --- modules/model_probe.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/model_probe.py b/modules/model_probe.py index f20709890..77f0525d2 100644 --- a/modules/model_probe.py +++ b/modules/model_probe.py @@ -329,23 +329,22 @@ def comfy_marker_format(path: str) -> str | None: return None -# quant format / dtype to the short precision token used in filenames -QUANT_PRECISION_TOKENS = {'int8_tensorwise': 'int8', 'float8_e4m3fn': 'fp8', 'float8_e5m2': 'fp8', 'nvfp4': 'nvfp4', 'mxfp8': 'mxfp8'} -DTYPE_PRECISION_TOKENS = {'F32': 'fp32', 'F16': 'fp16', 'BF16': 'bf16', 'F8_E4M3': 'fp8', 'F8_E5M2': 'fp8'} +# quant format / dtype to the precision token used in filenames; fp8 stays +# variant-specific because e4m3fn and e5m2 differ in kernel support +QUANT_PRECISION_TOKENS = {'int8_tensorwise': 'int8', 'float8_e4m3fn': 'fp8_e4m3fn', 'float8_e5m2': 'fp8_e5m2', 'nvfp4': 'nvfp4', 'mxfp8': 'mxfp8'} +DTYPE_PRECISION_TOKENS = {'F32': 'fp32', 'F16': 'fp16', 'BF16': 'bf16', 'F8_E4M3': 'fp8_e4m3fn', 'F8_E5M2': 'fp8_e5m2'} def precision_token(probe: dict) -> str | None: - """Short filename token for a probe's true precision; None when the - container encodes it already (gguf) or nothing is known.""" + """Filename token for a probe's true precision; None when the container + encodes it already (gguf) or nothing is known.""" quant = probe.get('quant') or {} scheme = quant.get('scheme') if scheme == 'gguf': return None - if scheme == 'comfy_quant': + if scheme in ('comfy_quant', 'scaled_fp8'): fmt = quant.get('format') or '' return QUANT_PRECISION_TOKENS.get(fmt, re.sub(r'[^a-z0-9]', '', fmt.lower()) or None) - if scheme == 'scaled_fp8': - return 'fp8' return DTYPE_PRECISION_TOKENS.get(probe.get('dominant_dtype') or '')