Flux Dev (Black-Forest-Labs) - Installation Tutorial
Table of Contents
Introduction
This tutorial guides you through the installation of the Flux models from Black Forest Labs using the ComfyUI interface. Whether you are a beginner or have some experience, this step-by-step guide will help you set up the environment required for image generation with Flux.
Step 1: Prepare Your Environment
-
Install Necessary Software
- Ensure you have Python, Git, and Miniconda installed on your system. If not, follow these tutorials:
-
Install CUDA and CuDNN
- Install CUDA Toolkit and CuDNN for your Nvidia GPU:
Step 2: Download ComfyUI
-
Search for ComfyUI
- Open your browser and search for "Comfy Anonymous Comfy UI".
-
Clone the Repository
- Visit the repository page and scroll to the installation section.
- Open your terminal and create a temporary directory:
mkdir temp cd temp
- Clone the ComfyUI repository:
git clone <repository-url>
Step 3: Set Up a Virtual Environment
-
Change Directory
- Navigate to the cloned ComfyUI directory:
cd comfy-ui
- Navigate to the cloned ComfyUI directory:
-
Create a Virtual Environment
- Create a virtual environment named 'venv':
python -m venv venv
- Create a virtual environment named 'venv':
-
Activate the Virtual Environment
- Activate the environment:
- Windows:
.\venv\Scripts\activate
- Linux:
source venv/bin/activate
- Windows:
- Activate the environment:
Step 4: Install Required Packages
-
Install CUDA Toolkit
- Install the CUDA toolkit specific to your configuration:
conda install -c nvidia cudatoolkit=11.8 -y
- Install the CUDA toolkit specific to your configuration:
-
Install PyTorch
- Install the appropriate version of PyTorch with CUDA support:
pip install torch==1.12.1+cu118 torchvision==0.13.1+cu118 torchaudio==0.12.1 -f https://download.pytorch.org/whl/torch_stable.html
- Install the appropriate version of PyTorch with CUDA support:
-
Install Other Requirements
- Install additional required packages:
pip install -r requirements.txt
- Install additional required packages:
Step 5: Launch ComfyUI
-
Run the Application
- Start the ComfyUI server:
python main.py
- Start the ComfyUI server:
-
Access the Web Interface
- Open your web browser and navigate to the URL provided in the terminal to access the ComfyUI interface.
Step 6: Download Flux Model Files
-
Locate the Model Files
- Search for "examples of comfy UI workflows by comfy Anonymous" and scroll to the Flux section.
-
Download Required Files
- Download the following files to the specified directories:
- T5 XXL model to
models/clip
- Clip model to
models/clip
- The VAE model to
models/vae
- Flux model to
models/unet
- T5 XXL model to
- Download the following files to the specified directories:
-
Optional: Download FP8 Version
- If your machine is not powerful enough, download the FP8 version and place it in the
checkpoints
directory.
- If your machine is not powerful enough, download the FP8 version and place it in the
Step 7: Configure and Run Models
-
Load the Model in ComfyUI
- Drag and drop the downloaded image files into the ComfyUI interface to configure your workflow.
-
Generate Images
- Input your prompts in the text box and click "Q prompt" to generate images. You can modify the prompts to refine your output.
Conclusion
You have successfully installed the Flux models and set up the ComfyUI interface for image generation. Explore the interface, tweak your prompts, and experiment with different model settings. For quick installations, consider using the one-click installer available on the Cognibuild Patreon page. Happy generating!