Commit Graph

11 Commits

Author SHA1 Message Date
chelsealong 9601f4742b Reset stale quant state on reload and reject inferred NVFP4 embeddings
Address CodeRabbit review on #15410: clear quant_format/layout_type
when a module reloads an unquantized weight (previously stale state
made Linear.forward take the quantized path against a plain
Parameter), and raise instead of silently loading raw bytes when an
Embedding's inferred format is NVFP4, which the embedding path can't
dequantize.
2026-08-08 01:10:41 +00:00
chelsealong 6fc556d841 Infer quant format from weight dtype when comfy_quant omits it
The all-NUL-marker fix only covered layers with no comfy_quant config.
Layers with valid, non-empty comfy_quant JSON that carry a weight_scale
but no "format" key (e.g. a q_proj-style layer in the MiniMax H3 nvfp4
AWQ checkpoint) still hit "Unknown quantization format for layer ...".
Fall back to inferring the format from the on-disk weight dtype
(int8 -> int8_tensorwise, float8_e4m3fn -> float8_e4m3fn, uint8 ->
nvfp4) in both the shared _load_quantized_module path and the
mixed-precision Embedding's own inline handling, matching the
workaround documented in the issue.
2026-08-08 00:53:55 +00:00
chelsealong 67ce9cbf1c Fix crash loading quantized checkpoints with all-NUL comfy_quant markers
Some quantizers mark unquantized layers in a mixed-precision checkpoint
with an all-NUL comfy_quant placeholder tensor instead of omitting the
key. json.loads() misdetects the leading NUL bytes as UTF-32 and raises
UnicodeDecodeError; once that decode is patched around, the resulting
empty {} config still fails with "Unknown quantization format" because
the loader always requires an explicit format for any present marker.
Treat an all-NUL marker as if comfy_quant were absent so the layer loads
as a plain unquantized weight, matching the official MiniMax H3 nvfp4
AWQ text encoder.

Fixes #15400
2026-08-08 00:46:48 +00:00
comfyanonymous 73e84d5ec8
Support convrot int4 models. (#14859)
linear_dtype in comfy_quant metadata can be used to set if the int4 op does
the matrix multiplication in int8 or int4, the default is int4 on GPUs that
support it with fallback to int8 for GPUs that don't.
2026-07-09 18:57:09 -04:00
comfyanonymous 1a510f0423
Support int8 models. (#14636) 2026-06-25 11:23:58 -07:00
comfyanonymous dc202a2e51
Properly save mixed ops. (#11772) 2026-01-10 02:03:57 -05:00
comfyanonymous 6da00dd899
Initial ops changes to use comfy_kitchen: Initial nvfp4 checkpoint support. (#11635)
---------

Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com>
2026-01-05 21:48:58 -05:00
comfyanonymous 43071e3de3
Make old scaled fp8 format use the new mixed quant ops system. (#11000) 2025-12-05 14:35:42 -05:00
comfyanonymous 25022e0b09
Cleanup and fix issues with text encoder quants. (#10872) 2025-11-25 01:48:53 -05:00
comfyanonymous c58c13b2ba
Fix torch compile regression on fp8 ops. (#10580) 2025-11-01 00:25:17 -04:00
contentis 8817f8fc14
Mixed Precision Quantization System (#10498)
* Implement mixed precision operations with a registry design and metadate for quant spec in checkpoint.

* Updated design using Tensor Subclasses

* Fix FP8 MM

* An actually functional POC

* Remove CK reference and ensure correct compute dtype

* Update unit tests

* ruff lint

* Implement mixed precision operations with a registry design and metadate for quant spec in checkpoint.

* Updated design using Tensor Subclasses

* Fix FP8 MM

* An actually functional POC

* Remove CK reference and ensure correct compute dtype

* Update unit tests

* ruff lint

* Fix missing keys

* Rename quant dtype parameter

* Rename quant dtype parameter

* Fix unittests for CPU build
2025-10-28 16:20:53 -04:00