Flux Dev (Black-Forest-Labs) - Installation Tutorial

3 min read 7 months ago
Published on Aug 06, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

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

  1. Install Necessary Software

  2. Install CUDA and CuDNN

Step 2: Download ComfyUI

  1. Search for ComfyUI

    • Open your browser and search for "Comfy Anonymous Comfy UI".
  2. 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

  1. Change Directory

    • Navigate to the cloned ComfyUI directory:
      cd comfy-ui
      
  2. Create a Virtual Environment

    • Create a virtual environment named 'venv':
      python -m venv venv
      
  3. Activate the Virtual Environment

    • Activate the environment:
      • Windows:
        .\venv\Scripts\activate
        
      • Linux:
        source venv/bin/activate
        

Step 4: Install Required Packages

  1. Install CUDA Toolkit

    • Install the CUDA toolkit specific to your configuration:
      conda install -c nvidia cudatoolkit=11.8 -y
      
  2. 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
      
  3. Install Other Requirements

    • Install additional required packages:
      pip install -r requirements.txt
      

Step 5: Launch ComfyUI

  1. Run the Application

    • Start the ComfyUI server:
      python main.py
      
  2. 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

  1. Locate the Model Files

    • Search for "examples of comfy UI workflows by comfy Anonymous" and scroll to the Flux section.
  2. 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
  3. Optional: Download FP8 Version

    • If your machine is not powerful enough, download the FP8 version and place it in the checkpoints directory.

Step 7: Configure and Run Models

  1. Load the Model in ComfyUI

    • Drag and drop the downloaded image files into the ComfyUI interface to configure your workflow.
  2. 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!