Nodes/DiffSynth-ComfyUI/DiffSynth: FLUX.2 Loader
ComfyUI Node

DiffSynth: FLUX.2 Loader

FLUX.2 Loader — 56B of dev, or Klein if you'd like it to fit

By modelscope·Created about a month ago·Updated a day ago· 8
DiffSynth: FLUX.2 Loader
  • model_configs
  • tokenizer_config
  • vram_limit
  • pipe
◄torch_dtypebfloat16►
◄devicecuda►

FLUX.2 is 56B on paper - a 32B rectified-flow transformer sitting behind a Mistral-3 24B vision-language encoder - and it was rejected by a lot of people on exactly that basis. Then Klein arrived and reopened the consumer front: 4B Apache 2.0, about 13GB in practice, four steps, up to ten reference images, native output up to 4MP. Dev is the quality tier and wants 18-24GB even quantized; 9B Klein is non-commercial like dev.

This Loader brings up whichever of those you declared, using the pack's VRAM strategy rather than ComfyUI's built-in loading. It's three required sockets and two optional ones:

  • model_configs - merged list from DiffSynth: Merge ModelConfigs. This is where the transformer, text encoder and VAE all come in.
  • torch_dtype - bfloat16 (default), float16, float32.
  • device - cuda or cpu.
  • tokenizer_config - a single ModelConfig for the tokenizer directory. FLUX.2's encoder is a proper VLM, so it has a real tokenizer to load and the node wants it declared.
  • vram_limit - from a VRAM Limit node.

Output: pipe → DiffSynth: FLUX.2 Inference.

The wiring the templates use

For black-forest-labs/FLUX.2-dev, and identically for FLUX.2-klein-4B and FLUX.2-klein-9B with the repo id swapped: three ModelConfigs with patterns text_encoder/*.safetensors, transformer/*.safetensors, vae/diffusion_pytorch_model.safetensors, those three merged into model_configs, and a fourth ModelConfig on the same repo with pattern tokenizer/ going into tokenizer_config. Simple, and it works the same across the three checkpoints, which is unusual for this pack.

Note these are glob patterns, not filenames - FLUX.2 repos shard the transformer across several files, and the glob is how you get all of them.

Install

# ComfyUI Manager: search "DiffSynth-ComfyUI" → Install → restart

pip install git+https://github.com/modelscope/DiffSynth-Studio.git
cd ComfyUI/custom_nodes
git clone https://github.com/modelscope/DiffSynth-ComfyUI.git
cd .. && python main.py

# if 56B-dev-on-24GB is the plan:
pip install "diffsynth[quant] @ git+https://github.com/modelscope/DiffSynth-Studio.git"

FLUX.1-dev style gating doesn't apply to Klein 4B, but if a ModelConfig starts returning auth errors on a gated repo, that's a HuggingFace token problem, not a pack problem - set download_source to huggingface and make sure your token is exported.

Where people get burned

The distilled-versus-base trap is the big one, and it's documented to death in the Klein threads: the distilled checkpoints run 4 steps at CFG 1, the base checkpoints run 50 steps at CFG 4-5 and exist for training rather than generating. Running base at 4 steps or distilled at CFG 5 both look broken, and neither is. Second: don't assume GGUF. This pack loads safetensors through DiffSynth, so the Q4-Q8 GGUF habits that make FLUX fit on small cards don't apply - the levers here are torch_dtype, the quantization config and CPU offload. Third: CPU offload is doing real work on a 56B model, so build the four-stage VRAM Config before you queue a dev run and blame the sampler for the crash.

CategoryDiffSynth/loader

Inputs (5)

NameTypeDefaultDescription
torch_dtypeCOMBObfloat163 options: bfloat16, float16, float32
deviceCOMBOcuda2 options: cuda, cpu
model_configsDIFFSYNTH_MODEL_CONFIG_LIST—
tokenizer_configoptDIFFSYNTH_MODEL_CONFIG—
vram_limitoptDIFFSYNTH_VRAM_LIMIT—

Outputs (1)

NameTypeDescription
pipeDIFFSYNTH_PIPE—