TechSetupGuides
Intermediateaistable-diffusiondiffusionimage-generationvideo-generationpythonpytorch

ComfyUI - Node-Based AI Creation Engine

ComfyUI is a modular node-based GUI for Stable Diffusion and other AI models, providing complete control over image, video, audio, and 3D generation workflows.

  1. Step 1

    Overview

    ComfyUI is the most powerful and modular AI engine for content creation that gives visual professionals complete control over every model, parameter, and output. Its node-based graph interface enables creatives to generate images, videos, 3D models, audio, and more without writing code.

    Key features:

    • Node/Graph Interface: Visual workflow builder for complex AI pipelines
    • Multi-Model Support: Native support for 100+ open-source models including SD3.5, Flux 2, Wan 2.2, Hunyuan3D, MoChi, Stable Audio
    • Smart Execution: Only re-executes changed parts of workflows between generations
    • Memory-Efficient: Smart offloading allows running large models on GPUs with as low as 1GB VRAM
    • Offline-First: Works fully offline; core never downloads anything unless configured
    • Production-Ready: API endpoints for integration into production pipelines
    • App Mode: Complex workflows exposed through simple UIs
  2. Step 2

    Tech Stack and Architecture

    ComfyUI is built on Python with a flexible backend using PyTorch and a modern Vue.js frontend.

    Core Backend:

    • Python 3.12+ (3.13/3.14 supported)
    • PyTorch 2.4+ with CUDA/ROCm/XPU support
    • aiohttp for async server
    • SQLAlchemy for database operations
    • Pillow for image processing
    • numpy, scipy for computations

    Frontend:

    • Vue.js 3 (separate repo: ComfyUI_frontend)
    • TypeScript
    • Tailwind CSS
    • Hosted via comfyui-frontend-package PyPI

    Supported Hardware:

    • NVIDIA GPUs (CUDA 12.6/13.0)
    • AMD GPUs (ROCm 7.2, DirectML)
    • Intel Arc GPUs (torch XPU)
    • Apple Silicon (M1/M2/M3 via Metal)
    • Ascend NPUs, Cambricon MLUs
    • CPU-only mode (slow)

    Optional Dependencies:

    • transformers, tokenizers (LLM support)
    • sentencepiece (tokenizer)
    • safetensors (safe model loading)
    • kornia (computer vision)
    • spandrel (model loading)
    • comfy-kitchen (comfyorg integration)
    • av (video encoding)
    • glslang, PyOpenGL, glfw (3D rendering)
    Core Requirements:
    - comfyui-frontend-package
    - comfyui-workflow-templates
    - comfyui-embedded-docs
    - torch, torchvision, torchaudio
    - numpy>=1.25.0
    - einops
    - transformers>=4.50.3
    - tokenizers>=0.13.3
    - sentencepiece
    - safetensors>=0.4.2
    - aiohttp>=3.11.8
    - pyyaml, Pillow, scipy, tqdm
    - psutil, alembic, SQLAlchemy>=2.0.0
    - filelock, av>=14.2.0
    - comfy-kitchen>=0.2.8
    - requests, simpleeval>=1.0.0
    - blake3, kornia>=0.7.1, spandrel
  3. Step 3

    Installation - Desktop Application (Recommended)

    The easiest way to get started with ComfyUI is through the official Desktop Application, available for Windows and macOS.

    Advantages:

    • One-click installation
    • Built-in model management
    • Auto-updates
    • No command-line knowledge required

    Steps:

    1. Visit https://www.comfy.org/download
    2. Download the installer for your OS
    3. Run the installer
    4. Launch ComfyUI
    # Download from official website
    # Windows/macOS: https://www.comfy.org/download
    
    # Alternative: Use comfy-cli
    pip install comfy-cli
    comfy install
    comfy launch
  4. Step 4

    Installation - Windows Portable (NVIDIA)

    The portable package provides immediate access to ComfyUI with no installation needed. Simply extract and run.

    Requirements:

    • Windows 10/11
    • NVIDIA GPU (20 series or newer)
    • 7-Zip for extraction
    # Download portable package
    # https://github.com/comfyanonymous/ComfyUI/releases/latest/download/ComfyUI_windows_portable_nvidia.7z
    
    # Extract with 7-Zip
    7z x ComfyUI_windows_portable_nvidia.7z
    
    # Run (NVIDIA GPU)
    run_nvidia_gpu.bat
  5. Step 5

    Installation - Manual Install (Linux/Windows/macOS)

    Prerequisites:

    • Python 3.12+ (3.13 recommended)
    • PyTorch with appropriate backend
    • Git (for cloning repo)
    # 1. Clone repository
    git clone https://github.com/comfyanonymous/ComfyUI
    cd ComfyUI
    
    # 2. Install PyTorch for your GPU
    
    # NVIDIA (CUDA 13.0)
    pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
    
    # AMD (ROCm 7.2, Linux)
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm7.2
    
    # Apple Silicon
    pip install torch torchvision torchaudio
    
    # 3. Install ComfyUI dependencies
    pip install -r requirements.txt
    
    # 4. Run ComfyUI
    python main.py
    
    # Access at http://127.0.0.1:8188
  6. Step 6

    Running ComfyUI

    After installation, run ComfyUI with python main.py.

    Common Flags:

    • --port <port>: Set port (default: 8188)
    • --external: Listen on all network interfaces
    • --preview-method <method>: Set preview method (auto, taesd)
    • --output-dir <dir>: Set output directory
    • --cpu: Run on CPU only (slow)
    • --enable-manager: Enable ComfyUI-Manager
    • --disable-api-nodes: Disable external API nodes
    # Basic run
    python main.py
    
    # Listen on all interfaces
    python main.py --external
    
    # Custom port and high-quality previews
    python main.py --port 8080 --preview-method taesd
    
    # With Manager extension
    python main.py --enable-manager
    
    # CPU only (for testing)
    python main.py --cpu
  7. Step 7

    AMD GPU Tips

    AMD cards not officially supported by ROCm can be enabled via environment variables:

    GFX Override:

    • RX 6700, 6600 (RDNA2): HSA_OVERRIDE_GFX_VERSION=10.3.0
    • RX 7600 (RDNA3): HSA_OVERRIDE_GFX_VERSION=11.0.0
    # RDNA2 cards (6700, 6600)
    HSA_OVERRIDE_GFX_VERSION=10.3.0 python main.py
    
    # RDNA3 cards (7600)
    HSA_OVERRIDE_GFX_VERSION=11.0.0 python main.py
    
    # Experimental memory efficient attention
    TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 python main.py --use-pytorch-cross-attention
  8. Step 8

    Keyboard Shortcuts

    Master these essential shortcuts:

    • Ctrl+Enter: Queue generation
    • Ctrl+Shift+Enter: Queue as first
    • Ctrl+Z/Y: Undo/Redo
    • Ctrl+S: Save workflow
    • Ctrl+O: Load workflow
    • Delete: Delete node
    • Space+Drag: Pan canvas
    • P: Pin node
    • Ctrl+G: Group nodes
    • F: Toggle menu
    Essential Shortcuts:
    Ctrl+Enter - Queue generation
    Ctrl+Shift+Enter - Queue as first
    Ctrl+Z/Y - Undo/Redo
    Ctrl+S - Save workflow
    Ctrl+O - Load workflow
    Ctrl+G - Group nodes
    Delete - Delete node
    Space+Drag - Pan canvas
    P - Pin node
    F - Toggle menu
    R - Refresh graph
    H - Toggle history
    Q - Toggle queue
  9. Step 9

    Resources & Community

    Official Resources:

    • Website: https://www.comfy.org/
    • Documentation: https://docs.comfy.org
    • GitHub: https://github.com/comfyanonymous/ComfyUI

    Community:

    • Discord: https://discord.com/invite/comfyorg
    • Matrix: #comfyui_space:matrix.org
    • Examples: https://comfyanonymous.github.io/ComfyUI_examples/
    Official Links:
    Website: https://www.comfy.org/
    Docs: https://docs.comfy.org
    GitHub: https://github.com/comfyanonymous/ComfyUI
    Discord: https://discord.com/invite/comfyorg
    Matrix: #comfyui_space:matrix.org
    Examples: https://comfyanonymous.github.io/ComfyUI_examples/

Feature requests

Sign in to suggest features or vote on existing ones.

No feature requests yet.

Discussion

0 people marked this as worked·Sign in to mark your own.

Sign in to join the discussion.

No comments yet.