ComfyUI is a node-based user interface (UI) primarily designed for building, visualizing, and customizing stable diffusion AI workflows. It allows users to create complex pipelines for AI-based image generation intuitively and modularly. ComfyUI simplifies the process of managing AI models, connecting nodes, and experimenting with different configurations to produce high-quality results.
- GPU Support:
- NVIDIA GPUs (compatible with CUDA).
- AMD GPUs (compatible with ROCm).
- Python 3.10 or higher.
- Operating Systems: Windows, macOS, Linux (Linux recommended for maximum performance).
Download the ComfyUI project using Git:
git clone https://github.com/comfyanonymous/ComfyUI.gitNavigate to the project directory:
cd ComfyUICreate and activate a virtual environment to isolate dependencies:
python -m venv venv
source venv/bin/activate (Linux/MacOS)
venv\Scripts\activate (Windows)Install required Python dependencies:
pip install -r requirements.txtRun the server:
python main.pyOpen your browser and go to: http://127.0.0.1:8188
- Design workflows visually by dragging and dropping nodes (components of the Stable Diffusion pipeline).
- Connect nodes to define the relationships between tasks.
- Model Management:
- Load and switch between Stable Diffusion models (checkpoints,
.ckpt, or.safetensorsfiles). - Manage VAE (Variational Autoencoder) for enhancing outputs.
- Load and switch between Stable Diffusion models (checkpoints,
- Image Generation:
- Create images using Text-to-Image (T2I) or Image-to-Image (I2I) workflows.
- Configure parameters such as resolution, sampling method, CFG scale, and steps.
- Customizable Pipelines:
- Add nodes for specialized tasks (e.g., prompt preprocessing, model loading, sampler, output).
- Batch Processing:
- Process multiple prompts, seeds, or images simultaneously.
- Advanced Imaging:
- Use additional nodes like ControlNet for advanced image editing capabilities (inpainting, sketch-to-image, etc.).
- Drag Text Prompt Node to the canvas.
- Input your desired prompt, such as "a futuristic cityscape".
- Add Model Loader Node and select your preferred AI model (e.g., Stable Diffusion checkpoint).
- Attach Sampler Node to specify the sampling method (e.g., DDIM, Euler).
- Connect an Image Output Node at the end to display/save the generated image.
- Run the pipeline after connecting the nodes!
Place your .ckpt or .safetensors files under the appropriate models directory.
Place your VAE files into the vae directory.
- Download pre-trained ControlNet checkpoint files and add them to the models directory.
- Configure ControlNet nodes in the ComfyUI interface to enable advanced workflows.
Customize the config.json file for better performance:
{
"device": "cuda",
"always_use_CPU": false,
"workflow_directory": "./workflows",
"model_directory": "./models"
}-
Python Version Requirements: Ensure you're using Python 3.10 or higher.
-
Missing Dependencies: Run
pip install -r requirements.txtagain to install dependencies properly. -
GPU Compatibility Issues: Install the correct CUDA Toolkit for NVIDIA GPUs, or use ROCm for AMD GPUs.
-
Performance Tuning: Enable optimizations like XFormers to improve memory efficiency (if supported).
To process multiple image prompts:
- Add a Batch Prompt Node.
- Specify multiple text prompts (e.g., "a sunset over the ocean" and "a forest in winter").
- Configure the Sampler Node and enable batch settings as needed.
- Generate all images concurrently.
Run the main server script:
python main.pyAccess http://127.0.0.1:8188 in your browser.
- Install dependencies.
- Open and configure ComfyUI.
- Build workflows visually by connecting nodes.
- Experiment with parameters and generate your desired output.
- Save results and refine workflows iteratively.
This Markdown file outlines the features, installation instructions, workflow usage, and troubleshooting tips for getting started with ComfyUI. Save the content into a file named ComfyUI.md for documentation purposes.