stable-diffusion.cpp/docs/models/flux2.md

11 KiB

FLUX.2

FLUX.2 supports text-to-image generation and reference-image editing. Choose the text encoder matching the transformer variant.

Model files

Flux.2-dev

Component Weights and downloads CLI option Requirement
FLUX.2 dev GGUF --diffusion-model Required for dev
FLUX.2 VAE Safetensors --vae Choose one compatible VAE
FLUX.2 small decoder Safetensors --vae Alternative VAE
Mistral Small 3.2 24B GGUF --llm Required for dev

Flux.2 klein 4B / Flux.2 klein base 4B

Component Weights and downloads CLI option Requirement
FLUX.2 Klein 4B Safetensors
GGUF
--diffusion-model Choose Klein or Klein Base
FLUX.2 Klein Base 4B Safetensors
GGUF
--diffusion-model Choose Klein or Klein Base
FLUX.2 VAE Safetensors --vae Choose one compatible VAE
FLUX.2 small decoder Safetensors --vae Alternative VAE
Qwen3 4B Safetensors
GGUF
--llm Required for 4B variants

Flux.2 klein 9B / Flux.2 klein base 9B

Component Weights and downloads CLI option Requirement
FLUX.2 Klein 9B Safetensors
GGUF
--diffusion-model Choose Klein or Klein Base
FLUX.2 Klein Base 9B Safetensors
GGUF
--diffusion-model Choose Klein or Klein Base
FLUX.2 VAE Safetensors --vae Required for these examples
Qwen3 8B Safetensors
GGUF
--llm Required for 9B variants

Usage

Web UI

Follow the Web UI guide to start the server, then select the recipe matching your weights. Fill the component slots below and click Load models. Use the files and compatibility requirements in Model files.

Recipe Component slots
FLUX.2 dev (flux2-dev) diffusion_model, llm, vae, tae
FLUX.2 Klein 4B (flux2-klein-4b) diffusion_model, llm, vae, tae
FLUX.2 Klein Base 4B (flux2-klein-base-4b) diffusion_model, llm, vae, tae
FLUX.2 Klein 9B (flux2-klein-9b) diffusion_model, llm, vae, tae
FLUX.2 Klein Base 9B (flux2-klein-base-9b) diffusion_model, llm, vae, tae

Slot IDs correspond to CLI component options: diffusion_model uses --diffusion-model, llm uses --llm, and model uses -m / --model. Select optional components when required by your checkpoint or task.

DGL

Example Description
Dev: image editing Edit a reference image.
Klein 4B: text to image Distilled 4B checkpoint.
Klein 4B: image editing Distilled 4B checkpoint.
Klein Base 4B: text to image Base 4B checkpoint.
Klein 9B: text to image Distilled 9B checkpoint.
Klein 9B: image editing Distilled 9B checkpoint.
Klein Base 9B: text to image Base 9B checkpoint.

Run a script

Edit paths, prompts and settings in the script's var block, then run from the build directory. Paths inside the script resolve from the working directory.

Windows (PowerShell)

.\bin\Release\sd-cli.exe -M dgl --script ..\docs\dgl\flux2\flux2-dev-edit.dgl

Linux/macOS

./bin/sd-cli -M dgl --script ../docs/dgl/flux2/flux2-dev-edit.dgl

Choose another script from the table to run a different task. Add --check to validate syntax and types without loading weights. See the shared run instructions for build paths and the server's file-access rules.

Legacy CLI

CLI examples use the shared path and shell conventions.

Flux.2-dev

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\flux2-dev-Q4_K_S.gguf `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M.gguf `
  -r .\kontext_input.png `
  -p "change 'flux.cpp' to 'flux2-dev.cpp'" `
  --cfg-scale 1.0 `
  --sampling-method euler `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/flux2-dev-Q4_K_S.gguf \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M.gguf \
  -r ./kontext_input.png \
  -p "change 'flux.cpp' to 'flux2-dev.cpp'" \
  --cfg-scale 1.0 \
  --sampling-method euler \
  --offload-to-cpu \
  -v
flux2 example

Flux.2 klein 4B / Flux.2 klein base 4B

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\flux-2-klein-4b.safetensors `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\qwen_3_4b.safetensors `
  -p "a lovely cat" `
  --cfg-scale 1.0 `
  --steps 4 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/flux-2-klein-4b.safetensors \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/qwen_3_4b.safetensors \
  -p "a lovely cat" \
  --cfg-scale 1.0 \
  --steps 4 \
  --offload-to-cpu \
  -v
flux2-klein-4b

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\flux-2-klein-4b.safetensors `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\qwen_3_4b.safetensors `
  -r .\kontext_input.png `
  -p "change 'flux.cpp' to 'klein.cpp'" `
  --cfg-scale 1.0 `
  --sampling-method euler `
  --steps 4 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/flux-2-klein-4b.safetensors \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/qwen_3_4b.safetensors \
  -r ./kontext_input.png \
  -p "change 'flux.cpp' to 'klein.cpp'" \
  --cfg-scale 1.0 \
  --sampling-method euler \
  --steps 4 \
  --offload-to-cpu \
  -v
flux2-klein-4b-edit

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\flux-2-klein-base-4b.safetensors `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\qwen_3_4b.safetensors `
  -p "a lovely cat" `
  --cfg-scale 4.0 `
  --steps 20 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/flux-2-klein-base-4b.safetensors \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/qwen_3_4b.safetensors \
  -p "a lovely cat" \
  --cfg-scale 4.0 \
  --steps 20 \
  --offload-to-cpu \
  -v
flux2-klein-base-4b

Flux.2 klein 9B / Flux.2 klein base 9B

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\flux-2-klein-9b.safetensors `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\qwen_3_8b.safetensors `
  -p "a lovely cat" `
  --cfg-scale 1.0 `
  --steps 4 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/flux-2-klein-9b.safetensors \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/qwen_3_8b.safetensors \
  -p "a lovely cat" \
  --cfg-scale 1.0 \
  --steps 4 \
  --offload-to-cpu \
  -v
flux2-klein-9b

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\flux-2-klein-9b.safetensors `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\qwen_3_8b.safetensors `
  -r .\kontext_input.png `
  -p "change 'flux.cpp' to 'klein.cpp'" `
  --cfg-scale 1.0 `
  --sampling-method euler `
  --steps 4 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/flux-2-klein-9b.safetensors \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/qwen_3_8b.safetensors \
  -r ./kontext_input.png \
  -p "change 'flux.cpp' to 'klein.cpp'" \
  --cfg-scale 1.0 \
  --sampling-method euler \
  --steps 4 \
  --offload-to-cpu \
  -v
flux2-klein-9b-edit

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\flux-2-klein-base-9b.safetensors `
  --vae ..\models\vae\flux2_ae.safetensors `
  --llm ..\models\text_encoders\qwen_3_8b.safetensors `
  -p "a lovely cat" `
  --cfg-scale 4.0 `
  --steps 20 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/flux-2-klein-base-9b.safetensors \
  --vae ../models/vae/flux2_ae.safetensors \
  --llm ../models/text_encoders/qwen_3_8b.safetensors \
  -p "a lovely cat" \
  --cfg-scale 4.0 \
  --steps 20 \
  --offload-to-cpu \
  -v
flux2-klein-base-9b