BennyDaBall's picture
Attribute Qwen Image 2.1 and update release name and workflows
4da87a3 verified
|
Raw
History Blame Contribute Delete
1.95 kB

Native NVFP4 text conditioning

The checkpoints load with existing ComfyUI nodes. On the tested ComfyUI revision, normal text conditioning runs in FP32 and dequantizes the encoder weights. The image transformer already uses native NVFP4 compute.

qwen21-nvfp4-conditioning.patch enables native NVFP4 matrix multiplication for Qwen Image 2.1 conditioning. It detects NVFP4 checkpoint metadata, converts the completed multimodal embeddings to BF16 on supported GPUs, and uses ComfyUI's existing quantized-matmul context. The context restores the previous operation settings after encoding. Vision preprocessing and the unnormalized final hidden state contract are preserved. BF16 and INT8 checkpoints keep the original path.

Tested base: 99073836d45f66053c45ba8564984e6def9cebba. No custom nodes, monkey-patching node pack, or additional runtime dependencies.

Stop ComfyUI. From its Git checkout, apply the supplied patch:

git apply --check C:/path/to/Qwen-Image-2.1-NVFP4/runtime/qwen21-nvfp4-conditioning.patch
git apply C:/path/to/Qwen-Image-2.1-NVFP4/runtime/qwen21-nvfp4-conditioning.patch

Restart ComfyUI. If the check fails, inspect the installed version and local changes; do not force the patch onto a different implementation. An upstream version may already provide equivalent support. To undo this exact patch, stop ComfyUI and use git apply -R with the same patch file.

The same workflows also run without the patch, using native NVFP4 denoising and weight-only encoder quantization with FP32 conditioning. That mode is slower for uncached encoding and can produce a different image. All advertised accelerated results use the patch.

Validation used an RTX 5090, CUDA 13.0 PyTorch, and comfy-kitchen 0.2.35. Other GPUs and CPU execution were not benchmarked. This is an independent patch, not an upstream ComfyUI release. The patch is subject to ComfyUI's GPL-3.0 license.