FLUX.2 Klein 9B (ComfyUI)

Black Forest Labs

FLUX.2 Klein 9B for ComfyUI, accelerated by TheStage AI Qlip engines.

Python usage

Overview

Elastic ComfyUI models are precompiled inference engines produced by TheStage AI Qlip. They replace the transformer blocks of the original FLUX.2 Klein 9B model inside ComfyUI: you keep your usual loaders, samplers and VAE, and the heavy denoising runs through optimized TensorRT engines. Base model weights are not included; the engines work on top of the original checkpoint.

On TheStage AI platform the Qlip engines are listed as size S; Original is the same model in eager PyTorch. Depending on the GPU, the following precision variants are available:

BF16: mathematically equivalent network, optimized with our DNN compiler.

FP8: 8-bit weights and activations, near-lossless, the default choice on Hopper GPUs.

NVFP4 (Blackwell only): 4-bit weights and activations, the fastest variant on RTX 5090 / B200.

NVFP4 + FP4 attention (RTX 5090 only): attention matmuls also run in 4 bit. Needs the fp4attn plugin from an upcoming qlip release.

All engines with the _lora suffix accept LoRA at runtime: LoRA weights are engine inputs, so you can switch LoRAs without recompiling. Engines are GPU-architecture specific: use the folder for your GPU.

About the model. FLUX.2 Klein is a 9B dual-stream DiT for image generation. Engines are provided for the distilled variant (4 steps, cfg 1.0, batch 1) and, on H100, also the base variant (50 steps, cfg 3.5, batch 2). On H100 the engines are text-to-image; on Blackwell (RTX 5090, B200) they are compiled in image-edit mode with one reference image, so use them with the edit workflow. Original model: black-forest-labs/FLUX.2-klein-9B.

System Requirements

PropertyValue
GPUH100, RTX 5090, B200
Python Version3.10-3.12
CPUIntel/AMD x86_64
CUDA Version12.8+ (H100), 13.0 (RTX 5090 / B200)
TensorRT10.13.3.9 (H100), 10.15.1.29 (RTX 5090 / B200)
ComfyUI commit048dd2f3 (H100), b615af1c (RTX 5090 / B200)

TheStage AI Access Token Setup

Engines require a TheStage AI access token. The installer below already installs the thestage CLI; set the token once (Profile -> Access tokens on the platform):

thestage config set --access-token <YOUR_ACCESS_TOKEN>

Without a token import qlip fails with [PyArmor] Validation failed. This is not a broken install: set the token and retry.

ComfyUI-Qlip

Elastic ComfyUI models are used through the ComfyUI-Qlip custom nodes. Here is how to run FLUX.2 Klein 9B with them.

Installation

From your ComfyUI root, with its virtual environment active:

git clone https://github.com/TheStageAI/ComfyUI-Qlip custom_nodes/ComfyUI-Qlip
python custom_nodes/ComfyUI-Qlip/install.py
thestage config set --access-token <YOUR_ACCESS_TOKEN>
python -c "import torch, tensorrt, qlip; print(torch.__version__, tensorrt.__version__)"

The installer detects the GPU and installs a matching stack in this order: the torch build for the device, ComfyUI's own requirements with torch pinned, then TensorRT and qlip.core. Do not run ComfyUI's requirements.txt by hand: it can replace the torch build. Use --device nvidia or --device blackwell to force a profile and --dry-run to print the plan.

ProfileGPUsStack
nvidiaH100, H200 (Hopper / Ada)torch 2.9.1+cu128, TensorRT 10.13.3.9, qlip.core[nvidia]
blackwellRTX 5090, B200torch 2.12.0+cu130, TensorRT 10.15.1.29, qlip.core[blackwell] installed with --no-deps

Engines are tied to the TensorRT version they were built with, so use the profile that matches your GPU.

Pin ComfyUI to the commit the engines were compiled against (engines are tied to the ComfyUI block structure):

cd /path/to/ComfyUI
git checkout 048dd2f3   # H100 engines
# or: git checkout b615af1c   # RTX 5090 / B200 engines

Download the original model

export COMFYUI_PATH=/path/to/ComfyUI
bash custom_nodes/ComfyUI-Qlip/scripts/download_flux_klein_models.sh

FLUX.2 Klein is gated: log in with hf auth login (or set HF_TOKEN) and accept the license first.

Usage

Load the workflow for your GPU in ComfyUI:

H100 (text-to-image): custom_nodes/ComfyUI-Qlip/workflows/flux-klein.json

RTX 5090 / B200 (image edit): custom_nodes/ComfyUI-Qlip/workflows/flux_klein_edit.json

Its Qlip Engines Loader node sits between the model loader and the sampler. Set hf_repo to the engines for your GPU: they are downloaded once and cached, then loaded on the first run.

UNETLoader / CheckpointLoaderSimple (original checkpoint)
  -> Qlip Engines Loader (hf_repo=...)
    -> Guider -> Sampler -> VAEDecode -> Save
GPUVariant*hf_repo*
H100Distilled BF16 + LoRATheStageAI/Elastic-FLUX-2-Klein:models/H100/klein-9b_lora
H100Distilled FP8 + LoRATheStageAI/Elastic-FLUX-2-Klein:models/H100/klein-9b-fp8_lora
H100Base BF16 + LoRATheStageAI/Elastic-FLUX-2-Klein:models/H100/klein-base-9b_lora
H100Base FP8 + LoRATheStageAI/Elastic-FLUX-2-Klein:models/H100/klein-base-9b-fp8_lora
RTX 5090Edit FP8-dynamic + LoRATheStageAI/Elastic-FLUX-2-Klein:models/GeForce-RTX-5090/klein-9b-fp8-dynamic-edit_lora
RTX 5090Edit FP8-static + LoRATheStageAI/Elastic-FLUX-2-Klein:models/GeForce-RTX-5090/klein-9b-fp8-static-edit_lora
RTX 5090Edit NVFP4 + LoRATheStageAI/Elastic-FLUX-2-Klein:models/GeForce-RTX-5090/klein-9b-nvfp4-edit_lora
RTX 5090Edit NVFP4 + FP4 attention + LoRA †TheStageAI/Elastic-FLUX-2-Klein:models/GeForce-RTX-5090/klein-9b-nvfp4-fp4attn-edit_lora
RTX 5090Edit NVFP4 + FP4 attention, no LoRA †TheStageAI/Elastic-FLUX-2-Klein:models/GeForce-RTX-5090/klein-9b-nvfp4-fp4attn-edit-nolora
B200Edit FP8-dynamic + LoRATheStageAI/Elastic-FLUX-2-Klein:models/B200/klein-9b-fp8-dynamic-edit_lora
B200Edit NVFP4 + LoRATheStageAI/Elastic-FLUX-2-Klein:models/B200/klein-9b-nvfp4-edit_lora

† FP4-attention engines need the fp4attn TensorRT plugin, which ships in an upcoming qlip release. Until then use the NVFP4 engines without FP4 attention.

Distilled and base need separate engines (different batch sizes). H100 static profiles: 1024x1024 and 1024x864; any size from 512x512 to 1024x1024 is supported through the dynamic profile.

LoRA

Connect a Qlip LoRA Stack node to the lora_stack input of Qlip Engines Loader. Several stacks can be chained; their ranks add up and must fit the maximum rank the engines were compiled with. LoRA weights are swapped in place when the stack changes, without reloading engines. LyCORIS / LoKR formats are not supported.

Qlip LoRA Stack (my_lora.safetensors, strength=1.0) ────────────┐
UNETLoader / CheckpointLoaderSimple                             │
  -> Qlip Engines Loader (hf_repo=..., lora_stack=^)
    -> Guider -> Sampler -> VAEDecode -> Save

Optional speedups

Qlip Cache skips redundant denoising steps, and Qlip Progressive runs early steps at a lower resolution. Both work on top of the engines; see the node reference in the ComfyUI-Qlip README.