Downloads · 30 days
1.2K
33% of all-time downloads
tonera/FLUX.2-klein-4B-Nunchaku
FLUX.2-klein-4B-Nunchaku is a image-to-image model from tonera. Use it when you need one image transformed into another. It is set up for diffusers. The card lists the license as apache-2.0.
Downloads · 30 days
1.2K
33% of all-time downloads
All-time downloads
3.6K
Public
Parameters
3.9B
21 GB on disk
Likes
6
Public
Click a slice to open those files.
.safetensors21 GB · 100%
From the Hugging Face model README
Language: English | 中文
tonera/FLUX.2-klein-4B-Nunchakublack-forest-labs/FLUX.2-klein-4Bsvdq-<precision>_r32-FLUX.2-klein-4B-Nunchaku.safetensors; use nunchaku.utils.get_precision() for <precision> (commonly fp4 or int4) so the file name matches your environment and Nunchaku buildFlux2KleinPipeline support (official examples install from source):pip install "git+https://github.com/huggingface/diffusers.git"
Upstream Nunchaku has not merged FLUX.2 Klein support for a long time (PR #926 still pending). Do not copy patch files manually. Install the prebuilt wheel that matches your platform, Python, and CUDA:
Example (x86_64, Python 3.11, CUDA 13.0):
pip install torch==2.11.* torchvision==0.26.* torchaudio==2.11.* \
--index-url https://download.pytorch.org/whl/cu130
hf download tonera/vitoom-nunchaku \
nunchaku-1.3.0.dev20260622+cu13.0torch2.11-cp311-cp311-linux_x86_64.whl \
--local-dir ./wheels
pip install ./wheels/nunchaku-1.3.0.dev20260622+cu13.0torch2.11-cp311-cp311-linux_x86_64.whl
For other platforms (cu128, cp310, ARM64 aarch64), see the wheel table in the vitoom-nunchaku README.
Verify:
python -c "import nunchaku; from nunchaku import NunchakuFlux2Transformer2DModel; print(nunchaku.__version__)"
Assumes vitoom-nunchaku is installed and weights are available locally or at tonera/FLUX.2-klein-4B-Nunchaku; set REPO to your directory or Hugging Face model id.
import torch
from diffusers import Flux2KleinPipeline
from diffusers.utils import load_image
from nunchaku import NunchakuFlux2Transformer2DModel
from nunchaku.utils import get_precision
REPO = "tonera/FLUX.2-klein-4B-Nunchaku" # or local absolute path
NAME = "FLUX.2-klein-4B-Nunchaku"
transformer = NunchakuFlux2Transformer2DModel.from_pretrained(
f"{REPO}/svdq-{get_precision()}_r32-{NAME}.safetensors",
torch_dtype=torch.bfloat16,
)
pipe = Flux2KleinPipeline.from_pretrained(
REPO, torch_dtype=torch.bfloat16, transformer=transformer
)
pipe.to("cuda")
ref = load_image("https://example.com/your_ref.png").convert("RGB")
image = pipe(
prompt="Describe your edit in English…",
image=ref,
guidance_scale=1.0, # matches official Klein examples; tune if needed
num_inference_steps=4, # common for the distilled model; see Diffusers docs otherwise
generator=torch.Generator("cpu").manual_seed(1),
).images[0]
image.save("flux2_klein_4b_nunchaku.png")
For text-to-image, omit image (behavior per current Diffusers Flux2KleinPipeline docs). Use pipe.enable_model_cpu_offload() or similar if VRAM is tight.
| Parameter | Suggested value | Notes |
|---|---|---|
num_inference_steps | 4 | Common for distilled Klein models |
guidance_scale | 1.0 | Matches official Klein examples |
We recommend deploying and running via vitoom: it ships a complete vitoom-nunchaku runtime, Web UI, multi-reference editing, and LoRA management—no manual wheel install or file copying. See the vitoom repo and docker-usage-en.md for setup.
You need Docker, Docker Compose, and an NVIDIA GPU for inference (driver must support CUDA 13.0, matching vitoom’s cu130 inference images). Confirm GPU access:
docker run --rm --gpus all nvidia/cuda:13.0.0-base-ubuntu24.04 nvidia-smi
In the vitoom repo root, run the setup wizard (recommended):
git clone https://github.com/tonera/vitoom.git
cd vitoom
python scripts/setup_vitoom.py
Or copy .env.example to .env, fill in required fields (VITOOM_BACKEND_URL, VITOOM_WS_URL, VITOOM_INFERENCE_UPLOAD_AUTH_SECRET, etc.), then pull images:
python scripts/load_vitoom_images.py --components backend,visual
Start Backend:
docker compose up -d backend
Open http://127.0.0.1:8888 in your browser (port follows VITOOM_SERVER_PORT in .env).
Start the Visual inference service (FLUX.2 Klein is an image model; this profile is required):
docker compose -f docker-compose.inference.release.yml --profile visual up -d
Optional: run python scripts/download_initial_models.py to batch-download common models; or place weights under the host resources/models directory (override via VITOOM_MODELS_HOST_DIR in .env).
tonera/FLUX.2-klein-4B-NunchakuYou can also run the Python example above directly inside the vitoom Visual inference container.
FLUX.2 Klein supports LoRA on the quantized Transformer when using vitoom-nunchaku (wheel or vitoom Visual image)—no manual file copying required:
lora_path = "/path/to/your_lora.safetensors"
transformer.update_lora_params(lora_path)
transformer.set_lora_strength(0.8)
These quantized weights are derived from FLUX.2-klein-4B. The upstream model is under Apache 2.0; confirm upstream license terms and Black Forest Labs’ acceptable use policy before commercial use or redistribution.