Run this model with HF Jobs
Run lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
FLUX.2 Klein 4B Nunchaku Lite INT4 r32
Diffusers-loadable INT4 conversion of black-forest-labs/FLUX.2-klein-4B, quantized with
diffuse-compressor. It
loads with a plain from_pretrained call — no runtime graph patches and no extra
runtime package.
The transformer uses quant_method: nunchaku_lite, INT4 SVDQ with group size
64, rank 32, 100 SVDQ targets and 3 AWQ W4A16 targets. Six outer linears (embedders, norm_out.linear, proj_out) stay
in bf16, and the text_encoder component is BitsAndBytes 4-bit NF4 with bf16
compute. QKV projections are not fused, so this trades some speed for loading
through the stock Diffusers graph. Calibrated on 128 prompts at
4 steps, 1024x1024.
Benchmark
| Checkpoint | Latency | Max VRAM |
|---|---|---|
| This repo — Nunchaku Lite INT4 r32 + BNB4 text encoder | 4.93 s (stdev 0.02 s) | 9.96 GiB |
| Nunchaku Lite NVFP4 r32 + BNB4 text encoder | 1.52 s (stdev 0.00 s) | 10.07 GiB |
| FLUX.2 Klein 4B dense bf16 | 2.31 s (stdev 0.01 s) | 19.89 GiB |
NVIDIA RTX PRO 4000 Blackwell, settings as in the Run snippet below, one warmup and three measured runs, everything resident on the GPU with no offload. Latency covers the full pipeline call; VRAM is peak device usage.
That is 2.00x less VRAM than dense bf16, at 2.13x the latency. The latency gap is specific to this GPU, which has native FP4 tensor cores that only the NVFP4 build can use. INT4 is the build for Turing through Ada, where NVFP4 does not run at all; on Blackwell prefer the NVFP4 build.
Output Comparison
Dense reference (left) and this build (right). Same prompt, seed, scheduler, resolution, and step count. Pixel MAE 55.52 / RMSE 72.18, versus 52.94 / 69.64 for the NVFP4 build.
Run
Requires the Hugging Face kernels package and DIFFUSERS_TRUST_REMOTE_KERNELS=true,
plus a Diffusers build with the nunchaku_lite quantizer. INT4 needs
a Turing or newer NVIDIA GPU; Hopper is unsupported.
import torch
from diffusers import Flux2KleinPipeline
pipe = Flux2KleinPipeline.from_pretrained(
"lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32",
torch_dtype=torch.bfloat16,
).to("cuda")
image = pipe(
prompt="A glass robot tending orchids in a sunlit greenhouse, cinematic lighting, highly detailed",
generator=torch.Generator("cuda").manual_seed(12345),
width=1024,
height=1024,
num_inference_steps=4,
guidance_scale=1.0,
).images[0]
image.save("output.png")
- Downloads last month
- 21
Model tree for lite-infer/flux.2-klein-4b-nunchaku-lite-int4-r32
Base model
black-forest-labs/FLUX.2-klein-4B