FLUX, the new AI image generation model from Black Forest Labs, can be integrated with ComfyUI to allow you to generate images just like any other AI image model. FLUX rivals Stable Diffusion as one of the leading models, however, many have noticed that FLUX requires quite a bit more VRAM to run properly – if you have 8GB VRAM or less, you may see more consistent results with older SD models. This guide will walk you through the FLUX installation process using ComfyUI as an interface.
Prerequisites
Before we begin, make sure that you have:
- ComfyUI installed on your system
- Sufficient storage space (at least 30GB free)
- A compatible GPU (NVIDIA GPU with at least 8GB VRAM – 24GB is recommended for faster generations)
Step 1: Choose Your FLUX Version
FLUX comes in two main variants:
- Regular Full Version: Highest quality, but requires more VRAM – 8GB cards will take a long time generating
- Schnell FP8 Checkpoint Version: Easier to use and requires less VRAM
For this guide, we’ll focus on the Schnell FP8 Checkpoint Version, as it’s more accessible for most users.
Step 2: Download the FLUX Model
- Navigate to the ComfyUI models directory:
[Your ComfyUI installation path]/models/checkpoints/
- Download the FLUX model:
- For FLUX Schnell: flux1-schnell-fp8.safetensors
- For FLUX Full version: flux1-dev-fp8.safetensors
- Place the downloaded file into your
checkpoints
directory.
Step 3: Set Up ComfyUI Workflow
Here you can either set up your ComfyUI workflow manually, or use a template found online. The ComfyUI team has conveniently provided workflows for both the Schnell and Dev versions of the model. Simply drag and drop the images found on their tutorial page into your ComfyUI.
For setting up your own workflow, you can use the following guide as a base:
- Launch ComfyUI.
- In the ComfyUI interface, you’ll need to set up a workflow. Here’s a basic setup from ComfyUI: 1. Add a “Load Checkpoint” node. 2. Connect it to a “KSampler” node. 3. Add a “VAE Decode” node and connect it to the KSampler. 4. Finally, add a “Save Image” node connected to the VAE Decode.
- In the “Load Checkpoint” node, select the FLUX model you downloaded (either flux1-dev-fp8.safetensors or flux1-schnell-fp8.safetensors).
- Important: Set the CFG scale to 1.0 in the KSampler node when using FLUX.
Step 4: Optimize Settings (Optional)
If you’re using FLUX Dev:
- In the “Load Checkpoint” node, set the
weight_dtype
tofp8
for lower memory usage. - Be aware this might slightly reduce quality but significantly improves performance on lower-end systems.
For FLUX Schnell:
- This is already optimized for speed, typically able to generate images in just 4 steps.
Step 5: Start Generating!
- In the ComfyUI interface, find the text input field (usually connected to the KSampler node).
- Enter your prompt describing the image you want to generate.
- Click the “Generate” or “Queue Prompt” button (depending on your ComfyUI version).
Tips for Best Results
- Experiment with prompts: FLUX is excellent at following detailed prompts, including text, so be specific about what you want.
- Adjust sampling steps: For FLUX Dev, start with 20-30 steps. For FLUX Schnell, 4 steps is usually sufficient.
- Play with resolutions: If you’re low on VRAM, start with 512×512 and gradually increase as your system allows.
- Use negative prompts: To refine your results, use negative prompts to specify what you don’t want in the image.
Troubleshooting
- If you encounter “Out of Memory” errors, try reducing the resolution or using the FP8 version if you haven’t already. 8GB cards can struggle with FLUX. You can also try the following setting in your Nvidia control panel: “CUDA – Sysmem Fallback Policy” – Prefer No Sysmem Fallback. This will stop ComfyUI from using your system RAM once your VRAM is fully utilized, which can in turn greatly improve performance.
- Ensure your GPU drivers are up to date for optimal performance.
- Check the ComfyUI documentation or community forums for specific error messages or issues.
By following this guide, you should now have FLUX up and running with ComfyUI. We hope that you’ve found this guide useful and easy to follow along! Happy creating!