Run FLUX.2 dev in ComfyUI on Linux: FP8 Setup and VRAM Guide
This deep-dive covers flux.2 dev comfyui linux with actionable analysis, practical implications, and expert insights.
Quick answer: To run FLUX.2 dev locally in ComfyUI on Linux without a 90 GB data-center GPU, update ComfyUI to version 0.3.72 or newer, download the three FP8 split files from Comfy-Org/flux2-dev (flux2_dev_fp8mixed.safetensors, mistral_3_small_flux2_fp8.safetensors, and flux2-vae.safetensors) into their dedicated ComfyUI/models/ folders, set CLIPLoader type to flux2, and launch Python with PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to prevent CUDA memory fragmentation on 24 GB NVIDIA GPUs.
Why FLUX.2 dev Changes Local ComfyUI Workflows on Linux
Black Forest Labs' open-weight FLUX.2 dev architecture replaces the dual T5-XXL and CLIP-L encoder stack used in first-generation models with a 32B parameter Diffusion Transformer (DiT) paired with a 24B parameter Mistral 3 Small text encoder and an updated VAE. That overhaul adds native multi-reference image editing (combining up to 10 reference inputs in one pass), sharper typography, reliable hex-color adherence, and clean 1024x1024 up to 4-megapixel synthesis.
The catch is memory demand. Loading the unquantized BF16 weights together requires roughly 90 GB of VRAM. Switching to Comfy-Org's FP8 mixed-precision split files brings the workflow onto a single 24 GB RTX 3090, RTX 4090, or 32 GB RTX 5090 workstation. If you still need a clean base installation, follow our guide on how to run ComfyUI locally on Ubuntu with NVIDIA GPU acceleration first.
VRAM and System RAM Requirements by Precision Tier
Before downloading more than 50 GB of weights, match your GPU VRAM and host memory to the right FLUX.2 build. ComfyUI streams layers between system RAM and VRAM during text encoding and denoising, so host memory and swap space directly affect stability.
| Variant / Precision | Disk Footprint | Recommended VRAM | System RAM | Best Linux Use Case |
|---|---|---|---|---|
| FLUX.2 dev (BF16 Full) | ~90 GB | 96 GB+ (H100 / multi-GPU) | 128 GB | Reference quality benchmarks |
| FLUX.2 dev (FP8 Mixed) | ~52-54 GB | 24 GB - 32 GB (RTX 3090/4090/5090) | 64 GB (or 32 GB + swap) | Local production and multi-reference edits |
| GGUF / FLUX.2 Klein (4B/9B) | 12-26 GB | 12 GB - 16 GB (RTX 4070 Ti/4080) | 32 GB - 64 GB | Mid-range GPUs avoiding slow offloading |
If your Linux workstation is capped at 12 GB VRAM and you want rapid single-pass renders without heavy offloading, pair this workflow with our FLUX.1 dev and schnell ComfyUI setup guide for 12 GB VRAM on Ubuntu, or use the smaller FLUX.2 Klein builds.
Step 1: Update ComfyUI and Verify CUDA
FLUX.2 requires ComfyUI core 0.3.72 or newer for native flux2 loader support and updated DynamicVRAM memory management. Pull upstream changes inside your virtual environment and install the Hugging Face CLI:
cd ~/ComfyUI
source venv/bin/activate
git pull origin master
python3 -m pip install --upgrade -r requirements.txt
python3 -m pip install --upgrade "huggingface_hub[cli]"
Confirm PyTorch detects your NVIDIA GPU and CUDA version:
python3 -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.get_device_name(0))"
RTX 40-series (Ada Lovelace) and RTX 50-series (Blackwell) GPUs accelerate FP8 kernels natively, while Ampere cards like the RTX 3090 still save massive VRAM through software-dequantized FP8 weights.
Step 2: Download FLUX.2 dev FP8 Split Files
Comfy-Org packages FLUX.2 dev as modular components under split_files/ in the Comfy-Org/flux2-dev Hugging Face repository. Place each file in its exact ComfyUI directory:
- Diffusion Model (~33-35 GB):
flux2_dev_fp8mixed.safetensors->ComfyUI/models/diffusion_models/ - Text Encoder (~18 GB):
mistral_3_small_flux2_fp8.safetensors->ComfyUI/models/text_encoders/ - VAE:
flux2-vae.safetensors->ComfyUI/models/vae/ - Optional Turbo LoRA:
Flux_2-Turbo-LoRA_comfyui.safetensors->ComfyUI/models/loras/
Download all three required files with huggingface-cli and move them out of the nested split_files/ staging tree:
mkdir -p ~/ComfyUI/models/diffusion_models ~/ComfyUI/models/text_encoders ~/ComfyUI/models/vae
huggingface-cli download Comfy-Org/flux2-dev split_files/diffusion_models/flux2_dev_fp8mixed.safetensors split_files/text_encoders/mistral_3_small_flux2_fp8.safetensors split_files/vae/flux2-vae.safetensors --local-dir /tmp/flux2_dl
mv /tmp/flux2_dl/split_files/diffusion_models/flux2_dev_fp8mixed.safetensors ~/ComfyUI/models/diffusion_models/
mv /tmp/flux2_dl/split_files/text_encoders/mistral_3_small_flux2_fp8.safetensors ~/ComfyUI/models/text_encoders/
mv /tmp/flux2_dl/split_files/vae/flux2-vae.safetensors ~/ComfyUI/models/vae/
rm -rf /tmp/flux2_dl
Verify file sizes and permissions before launching:
ls -lh ~/ComfyUI/models/diffusion_models/flux2_dev_fp8mixed.safetensors ~/ComfyUI/models/text_encoders/mistral_3_small_flux2_fp8.safetensors ~/ComfyUI/models/vae/flux2-vae.safetensors
Step 3: Wire the Node Graph and Multi-Reference Editing
Open ComfyUI and load the built-in FLUX.2 dev FP8 template, or connect these four core nodes manually:
- UNETLoader: Choose
flux2_dev_fp8mixed.safetensorsand keep the weight dtype on default so mixed-precision layers stay intact. - CLIPLoader: Select
mistral_3_small_flux2_fp8.safetensorsand settypeexplicitly toflux2. Legacyfluxorsd3types cause tensor mismatch crashes. - FluxGuidance: Route your positive
CLIP Text Encodeconditioning throughFluxGuidancewithguidanceset to3.5before entering the sampler. When merging multiple conditionings, applyFluxGuidanceto each branch first. - VAELoader: Load
flux2-vae.safetensorsfor both reference-image encoding and final latent decoding.
Avoid Silent Fallback in Multi-Reference Templates
Many starter FLUX.2 templates ship with their reference image loaders and ReferenceLatent nodes bypassed so basic text-to-image works immediately. If you leave them bypassed, ComfyUI silently ignores your source photos. Select the reference loader, VAE Encode, and ReferenceLatent nodes, press Ctrl + B to unbypass them, and chain additional ReferenceLatent nodes to anchor multiple subjects or layouts. For high-resolution print output after generation, pass the result through a post-processing stage using our local AI image upscaling guide with RealESRGAN on Linux.
Step 4: Create an OOM-Safe Linux Launch Script
Outdated ComfyUI launch flags routinely break FLUX.2 on 24 GB Linux systems for three reasons:
--lowvramis a no-op under DynamicVRAM: Modern ComfyUI manages block offloading automatically viaDynamicVRAM. Passing--lowvramdoes nothing unless you add--disable-dynamic-vram, which typically increases OOM crashes on consumer GPUs.- CUDA allocator fragmentation: Swapping an 18 GB text encoder and a 34 GB diffusion model fragments rigid PyTorch memory blocks. Exporting
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:Truelets PyTorch allocate resizable virtual segments and reclaim gigabytes of trapped VRAM. - Wayland/X11 contention and Linux OOM-Killer: Reserving headroom via
--reserve-vram 1.5keeps your Linux desktop responsive at peak usage. On 32 GB RAM hosts, ensure ample swap space so the kernel OOM-Killer does not terminate Python during layer swaps; see our guide to configure zRAM swap for faster memory on Ubuntu Linux.
Save this startup script as ~/ComfyUI/run-flux2.sh:
#!/usr/bin/env bash
set -euo pipefail
export PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
export CUDA_MODULE_LOADING="LAZY"
cd "$HOME/ComfyUI"
source venv/bin/activate
exec python3 main.py --listen 127.0.0.1 --port 8188 --reserve-vram 1.5
chmod +x ~/ComfyUI/run-flux2.sh && ~/ComfyUI/run-flux2.sh
Troubleshooting Common FLUX.2 Linux Issues
- CUDA OOM right at 100% during decode: Swap
VAE DecodeforVAE Decode (Tiled)(tile size512, overlap64) to eliminate peak memory spikes on 2MP - 4MP images. CLIPLoadershape or key error: Confirm ComfyUI is at least0.3.72,typeis set toflux2, andmistral_3_small_flux2_fp8.safetensorssits inmodels/text_encoders/rather thanmodels/clip/.- Process exits with
Killed(exit 137): Checkdmesg -T | grep -i -E "oom|killed process". You hit system RAM exhaustion during model offloading; close heavy apps and add at least 32 GB of zRAM or disk swap. - Slow initial render: The first prompt compiles PyTorch CUDA kernels and populates DynamicVRAM; subsequent prompts at the same resolution complete much faster.
With ComfyUI updated, the three Comfy-Org/flux2-dev FP8 split weights verified, and expandable_segments:True enabled, FLUX.2 dev delivers crisp typography and multi-reference editing locally on Linux without cloud fees.
All terminal commands, code snippets, and configuration parameters in this guide were verified in our testing environment before publication. Adjust configuration paths to match your specific distribution.
Was this technical analysis helpful?
Your feedback informs our benchmark updates and ongoing article audits.
FAQ
Frequently Asked Questions
Structured for search engines and AI answer systems (AEO/GEO).
Unquantized BF16 FLUX.2 dev requires roughly 90 GB of VRAM, while the Comfy-Org FP8 mixed diffusion model paired with the FP8 Mistral 3 Small text encoder runs smoothly on 24 GB to 32 GB NVIDIA GPUs such as the RTX 3090, RTX 4090, or RTX 5090 alongside 32 GB to 64 GB of system RAM.
Place flux2_dev_fp8mixed.safetensors in ComfyUI/models/diffusion_models/, mistral_3_small_flux2_fp8.safetensors in ComfyUI/models/text_encoders/, and flux2-vae.safetensors in ComfyUI/models/vae/, then set CLIPLoader type to flux2.
Recent ComfyUI versions enable DynamicVRAM by default, making --lowvram a no-op unless you disable DynamicVRAM. Instead, export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True, pass --reserve-vram 1.5 for desktop headroom, and use VAE Decode (Tiled) for high-resolution renders.
Official FLUX.2 ComfyUI templates often ship with the ReferenceLatent and reference image loader nodes bypassed by default. Select those nodes and press Ctrl+B to unbypass them so encoded reference latents enter the conditioning chain.
More answers in our FAQ hub.
Newsletter
Practical Linux & Applied AI Newsletter
Get new tested tutorials and benchmark comparisons delivered directly to your inbox. Zero spam.
Join Weekly guides readers getting our weekly digest.
- Practical Linux administration & terminal workflows
- Tested open-source AI setups & benchmarks
- Zero spam - unsubscribe anytime