QuantFunc's picture
feat: Qwen-Image-Layered precision configs (config-only, no weights)
802c05d verified
|
Raw
History Blame Contribute Delete
5.34 kB
---
base_model:
- Qwen/Qwen-Image-Layered
base_model_relation: quantized
pipeline_tag: text-to-image
language:
- en
- zh
tags:
- text-to-image
- image-editing
- diffusion
- quantized
- quantfunc
- qwen
- layered
- precision-config
license: apache-2.0
---
# QuantFunc
<div align="center" style="margin-top: 50px;">
<img src="https://raw.githubusercontent.com/RealJonathanYip/ComfyUI-QuantFunc/main/assets/logo.webp" width="300" alt="Logo">
</div>
<p align="center">
๐Ÿค— <a href="https://huggingface.co/QuantFunc">Hugging Face</a> &nbsp;|&nbsp;
๐Ÿค– <a href="https://www.modelscope.cn/profile/QuantFunc">ModelScope</a> &nbsp;|&nbsp;
๐Ÿ’ป <a href="https://github.com/RealJonathanYip/ComfyUI-QuantFunc">GitHub</a> &nbsp;|&nbsp;
๐Ÿ’ฌ <a href="#wechat">WeChat (ๅพฎไฟก)</a> &nbsp;|&nbsp;
๐ŸŽฎ <a href="https://discord.gg/jCp9TpFWcn">Discord</a>
</p>
# Qwen-Image-Layered-Series
> โš ๏ธ **Config-only repository โ€” no model weights.**
> This repo contains **only** QuantFunc per-layer **precision configs** for **Qwen-Image-Layered** (RGBA layer decomposition). It does **not** contain, mirror, or redistribute any model weights. **You bring your own** official [`Qwen/Qwen-Image-Layered`](https://huggingface.co/Qwen/Qwen-Image-Layered); these configs only tell the QuantFunc engine how to quantize it **at load time, on your own machine**.
**Powered by the [QuantFunc ComfyUI plugin](https://github.com/RealJonathanYip/ComfyUI-QuantFunc) โ€” the fastest diffusion inference engine:**
- ๐Ÿš€ **2xโ€“11x speedup** over standard BF16/FP16 Python pipelines.
- โš™๏ธ **Native C++/CUDA** (`libquantfunc.so` / `quantfunc.dll`), **zero Python model dependencies**.
- ๐Ÿงฉ **Universal format adapter** โ€” loads **diffusers / BFL / HF** layouts directly, no manual conversion.
- ๐ŸŸข **Full GPU coverage** โ€” RTX 20/30/40/50 ยท A100/H100/H200/B100/B200 (CUDA 12 & 13); native **FP4** on Blackwell.
๐Ÿ‘‰ **Install the plugin:** **https://github.com/RealJonathanYip/ComfyUI-QuantFunc**
## What this repository provides
Just the precision configs โ€” **no weights**:
```
Qwen-Image-Layered-Series/
โ”œโ”€โ”€ config.json # = 50x-below INT4 map (HF download-counter query file)
โ””โ”€โ”€ precision-config/
โ”œโ”€โ”€ 50x-above-fp4-sample.json # NVFP4 (FP4 weights, af8wf4 MLP) โ€” RTX 50 / SM120+
โ””โ”€โ”€ 50x-below-int4-sample.json # INT4 per-group-128 โ€” all SMs (robust fallback)
```
We deliberately **do not host Qwen-Image-Layered weights**. The QuantFunc **Lighting** backend does **runtime** quantization: you load the *official* weights and they are quantized **in-memory at load**, so no pre-quantized checkpoint is ever distributed.
## How to use
1. **Obtain the official model yourself** โ€” [`Qwen/Qwen-Image-Layered`](https://huggingface.co/Qwen/Qwen-Image-Layered) (diffusers layout). Follow Qwen's distribution channels and license.
2. **Install the QuantFunc ComfyUI plugin:** https://github.com/RealJonathanYip/ComfyUI-QuantFunc
3. **Load the official model** through the **Build Pipeline** node (universal format adapter).
4. **Precision config** โ€” leave the node on **`auto detect`** (it recognizes Qwen-Image-Layered and applies the right map automatically: **NVFP4** on RTX 50 / SM120+, **INT4** otherwise), or point it at a file manually.
## Precision configs
Two GPU tiers (the auto-detect picks by SM):
| File | Target GPU | Scheme |
|------|-----------|--------|
| `50x-above-fp4-sample.json` | RTX 50 / SM120+ | **NVFP4** (FP4 e2m1 weights); **FP8 activations on the MLP only** (`af8wf4`), attention stays W4A4 |
| `50x-below-int4-sample.json` | RTX 20/30/40 + datacenter | **INT4** per-group-128 (AUTO_4 โ†’ INT4 on all SMs); robust, fully coherent at any SM |
**Why the MLP is `af8wf4` on the NVFP4 map:** `use_additional_t_cond` + layer3d modulation make the MLP input activations large enough to saturate the FP4-activation per-16 FP8 (e4m3 max 448) microscale โ†’ green-noise background. FP8 activation (per-token FP16 act-scale) on the MLP removes it; attention tolerates FP4 activation and stays on the fast W4A4 path. This differs from the base Qwen-Image NVFP4 map by **exactly one layer** (the MLP up-projection `net.0.proj`). In both maps the `img_mod`/`txt_mod` modulation GEMMs stay **INT8**.
### โš ๏ธ Companion settings REQUIRED for coherence (not part of the precision map)
- base scheduler (`configs/qwen-image-base-scheduler.json`)
- `num_inference_steps = 50`
- `true_cfg_scale = 4.0`
- **non-empty** `negative_prompt`
- a **real RGBA composite** input image
- resolution **640**
> NVFP4 (`50x-above`) is **SM120+ only** (FP4 is native `sm_120a`, never PTX-JIT). On older GPUs use the INT4 map.
## Legal / Attribution
- This repository distributes **only** the QuantFunc precision-config JSON โ€” our own work, Apache-2.0.
- It contains **no Qwen weights** and is **not affiliated with, nor endorsed by, the Qwen team**.
- You are solely responsible for obtaining the official model and complying with its license and terms of use.
## Community
- ๐ŸŽฎ [Discord server](https://discord.gg/jCp9TpFWcn)
- ๐Ÿ’ฌ Scan the QR code below to join our WeChat group:
<div align="center" id="wechat">
<img src="https://raw.githubusercontent.com/RealJonathanYip/ComfyUI-QuantFunc/main/assets/WeChat.jpg" alt="WeChat Group" width="300">
</div>