--- library_name: diffusers pipeline_tag: text-to-image base_model: - black-forest-labs/FLUX.2-klein-4B base_model_relation: quantized tags: - text-to-image - image-editing - diffusion - quantized - quantfunc - flux language: - en license: other license_name: quantfunc-model-license license_link: LICENSE --- ## License & Attribution These are **quantized derivative weights** of [`black-forest-labs/FLUX.2-klein-4B`](https://huggingface.co/black-forest-labs/FLUX.2-klein-4B) (**FLUX.2 [klein] 4B**). - **Modifications:** the original weights were quantized (e.g. W4A4 / FP4 / INT4 / FP8) and repackaged for the QuantFunc inference engine โ a "modification" under Apache-2.0 ยง4(b). - **Upstream license:** the base model is licensed under the **Apache License 2.0**, included here as [`LICENSE-APACHE`](./LICENSE-APACHE); the upstream copyright and attribution notices are retained. - **This derivative:** the QuantFunc quantization & packaging are additionally provided under the QuantFunc Model License (see [`LICENSE`](./LICENSE)). - This repository is **not affiliated with or endorsed by** the upstream model authors. > **Disclaimer:** Derived from FLUX.2 [klein] by Black Forest Labs. This is **not an official Black Forest Labs product** and is not endorsed by or affiliated with BFL. "FLUX" is a trademark of Black Forest Labs. # QuantFunc
๐ค Hugging Face | ๐ค ModelScope | ๐ป GitHub | ๐ฌ WeChat (ๅพฎไฟก) | ๐ฎ Discord
> โก **FLUX.2 Klein 4B โ pre-quantized for speed.** The lighter, fast Klein variant for text-to-image and reference-based editing, running **2xโ11x faster** with the QuantFunc plugin. This series ships the **distilled (4-step)** and **base (28-step)** FLUX.2 Klein **4B** transformers across **three GPU tiers** โ `50x` FP4 (Blackwell), `40x` INT4+FP8 (Ada/Hopper), `30x-below` INT4+INT8 (RTX 30 and below) โ so every card gets the fastest path it can run. **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 (pre-exported โ even faster loading). - โ๏ธ **Native C++/CUDA** (`libquantfunc.so` / `quantfunc.dll`) with **zero Python model dependencies**. - ๐งฉ **Dual engine** (SVDQ offline + Lighting runtime 4-bit), **zero-cost LoRA stacking**, reference-image editing & inpainting. - ๐ข **Full GPU coverage** โ RTX 20/30/40/50 ยท A100/H100/H200/B100/B200/GB300 ยท RTX 6000 Ada / PRO Blackwell (CUDA 12 & 13); native **FP4** on Blackwell. ๐ **Install the plugin:** **https://github.com/RealJonathanYip/ComfyUI-QuantFunc** # Klein-4B-Series Pre-quantized **FLUX.2 Klein 4B** model series by [QuantFunc](https://github.com/RealJonathanYip), Lighting backend. Text-to-image and reference-based image editing. > โจ **Both the distilled AND the non-distilled (base) model are supported**, and the series ships **three GPU tiers** so every card gets the best path it can run: > **`50x`** (Blackwell, FP4) ยท **`40x`** (RTX 40 / Ada & Hopper, INT4 + FP8) ยท **`30x-below`** (RTX 30 and below, INT4 + INT8). ## Overview FLUX.2 Klein is Black Forest Labs' Flux.2 family. The **4B** variant (the lighter, fast variant, transformer K=3072). QuantFunc ships, pre-quantized: - **Distilled** transformer โ 4-step, fastest few-step generation/editing. - **Base / non-distilled** transformer โ the full 28-step model with classical CFG (`--guidance-scale 4.0`), highest quality. โฆeach in 3 hardware tiers (below). Distilled and base **share the same base-model** โ only the transformer file differs. ## Hardware tiers (pick by GPU) FP4 needs Blackwell (SM120); FP8 needs Ada (SM89) or Hopper (SM90) โ e.g. RTX 40 / L40 / H100 / H200; INT4/INT8 run everywhere (Ampere/Turing, e.g. RTX 30/20, A100). So: | Tier | GPUs | attention + FFN | modulation/embedders/head | base-model | |------|------|-----------------|---------------------------|-----------| | **`50x`** | **Blackwell (SM120+)** โ RTX 50 series, B100/B200/GB200, RTX PRO Blackwell | **FP4** | **FP8** | `klein-4b-series-50x-above-base-model` (FP4 text encoder) | | **`40x`** | **RTX 40 / Ada (SM89) & Hopper (SM90)** โ RTX 40 series, L40/L40S, **H100, H200** | **INT4** | **FP8** | `klein-4b-series-50x-below-base-model` (INT4 text encoder) | | **`30x-below`** | **RTX 30 and below (pre-FP8)** โ RTX 30/20, A100, A40, T4, down to RTX 2080 | **INT4** | **INT8** | `klein-4b-series-50x-below-base-model` (INT4 text encoder) | > `40x` and `30x-below` **share** the same INT4 base-model โ they differ only in the transformer's 8-bit precision (FP8 vs INT8). `50x` uses the FP4 base-model. ## Directory Structure ``` Klein-4B-Series/ โโโ klein-4b-series-50x-above-base-model/ # FP4 text encoder + VAE(enc+dec) + tokenizer + scheduler (50x) โโโ klein-4b-series-50x-below-base-model/ # INT4 text encoder + VAE(enc+dec) + tokenizer + scheduler (40x & 30x-below) โโโ transformer/ โ โโโ config.json โ โโโ klein-4b-50x-lighting.safetensors # distilled, FP4 (50x) โ โโโ klein-4b-base-50x-lighting.safetensors # base 28-step, FP4 (50x) โ โโโ klein-4b-40x-lighting.safetensors # distilled, INT4 + FP8 (40x) โ โโโ klein-4b-base-40x-lighting.safetensors # base 28-step, INT4 + FP8(40x) โ โโโ klein-4b-30x-below-lighting.safetensors # distilled, INT4 + INT8 (30x-below) โ โโโ klein-4b-base-30x-below-lighting.safetensors # base 28-step, INT4 + INT8(30x-below) โโโ precision-config/ โโโ 50x-fp4-f8-sample.json โโโ 40x-int4-f8-sample.json โโโ 30x-below-int4-i8-sample.json ``` > **Status:** โ All weights uploaded; the VAE includes **both encoder and decoder**. Every tier ร {distilled, base} is visually validated to generate correctly. ## Distilled (4-step) vs Base (28-step) | Transformer | Source | Steps | Guidance | Best for | |---|---|---|---|---| | `klein-4b-