๐Ÿ“ฆ Comfy-Org / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.

โ˜… 100.8k stars โ‘‚ 11.4k forks ๐Ÿ‘ 100.8k watching โš–๏ธ GNU General Public License v3.0
aicomfycomfyuipythonpytorchstable-diffusion
๐Ÿ“ฅ Clone https://github.com/Comfy-Org/ComfyUI.git
HTTPS git clone https://github.com/Comfy-Org/ComfyUI.git
SSH git clone git@github.com:Comfy-Org/ComfyUI.git
CLI gh repo clone Comfy-Org/ComfyUI
comfyanonymous comfyanonymous Make omni stuff work on regular z image for easier testing. (#11985) 8ccc0c9 1 hours ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .ci
๐Ÿ“ .github
๐Ÿ“ alembic_db
๐Ÿ“ api_server
๐Ÿ“ app
๐Ÿ“ blueprints
๐Ÿ“ comfy
๐Ÿ“ comfy_api
๐Ÿ“ comfy_api_nodes
๐Ÿ“ comfy_config
๐Ÿ“ comfy_execution
๐Ÿ“ comfy_extras
๐Ÿ“ custom_nodes
๐Ÿ“ input
๐Ÿ“ middleware
๐Ÿ“ models
๐Ÿ“ output
๐Ÿ“ script_examples
๐Ÿ“ tests
๐Ÿ“ tests-unit
๐Ÿ“ utils
๐Ÿ“„ .gitattributes
๐Ÿ“„ .gitignore
๐Ÿ“„ alembic.ini
๐Ÿ“„ CODEOWNERS
๐Ÿ“„ comfyui_version.py
๐Ÿ“„ CONTRIBUTING.md
๐Ÿ“„ cuda_malloc.py
๐Ÿ“„ execution.py
๐Ÿ“„ folder_paths.py
๐Ÿ“„ latent_preview.py
๐Ÿ“„ LICENSE
๐Ÿ“„ main.py
๐Ÿ“„ new_updater.py
๐Ÿ“„ node_helpers.py
๐Ÿ“„ nodes.py
๐Ÿ“„ protocol.py
๐Ÿ“„ pyproject.toml
๐Ÿ“„ pytest.ini
๐Ÿ“„ QUANTIZATION.md
๐Ÿ“„ README.md
๐Ÿ“„ requirements.txt
๐Ÿ“„ server.py
๐Ÿ“„ README.md

ComfyUI

The most powerful and modular visual AI engine and application.

Website Dynamic JSON Badge Twitter Matrix

ComfyUI Screenshot

ComfyUI lets you design and execute advanced stable diffusion pipelines using a graph/nodes/flowchart based interface. Available on Windows, Linux, and macOS.

Get Started

Desktop Application

  • The easiest way to get started.
  • Available on Windows & macOS.

Windows Portable Package

  • Get the latest commits and completely portable.
  • Available on Windows.

Manual Install

Supports all operating systems and GPU types (NVIDIA, AMD, Intel, Apple Silicon, Ascend).

Examples

See what ComfyUI can do with the example workflows.

Features

  • Nodes/graph/flowchart interface to experiment and create complex Stable Diffusion workflows without needing to code anything.
  • Image Models
  • Pixart Alpha and Sigma
  • Hunyuan3D 2.0
  • Asynchronous Queue system
  • Many optimizations: Only re-executes the parts of the workflow that changes between executions.
  • Smart memory management: can automatically run large models on GPUs with as low as 1GB vram with smart offloading.
  • Works even if you don't have a GPU with: ``--cpu` (slow) - Can load ckpt and safetensors: All in one checkpoints or standalone diffusion models, VAEs and CLIP models. - Safe loading of ckpt, pt, pth, etc.. files. - Embeddings/Textual inversion - [Loras (regular, locon and loha)](https://comfyanonymous.github.io/ComfyUI_examples/lora/) - [Hypernetworks](https://comfyanonymous.github.io/ComfyUI_examples/hypernetworks/) - Loading full workflows (with seeds) from generated PNG, WebP and FLAC files. - Saving/Loading workflows as Json files. - Nodes interface can be used to create complex workflows like one for [Hires fix](https://comfyanonymous.github.io/ComfyUI_examples/2_pass_txt2img/) or much more advanced ones. - [Area Composition](https://comfyanonymous.github.io/ComfyUI_examples/area_composition/) - [Inpainting](https://comfyanonymous.github.io/ComfyUI_examples/inpaint/) with both regular and inpainting models. - [ControlNet and T2I-Adapter](https://comfyanonymous.github.io/ComfyUI_examples/controlnet/) - [Upscale Models (ESRGAN, ESRGAN variants, SwinIR, Swin2SR, etc...)](https://comfyanonymous.github.io/ComfyUI_examples/upscale_models/) - [GLIGEN](https://comfyanonymous.github.io/ComfyUI_examples/gligen/) - [Model Merging](https://comfyanonymous.github.io/ComfyUI_examples/model_merging/) - [LCM models and Loras](https://comfyanonymous.github.io/ComfyUI_examples/lcm/) - Latent previews with [TAESD](#how-to-show-high-quality-previews) - Works fully offline: core will never download anything unless you want to. - Optional API nodes to use paid models from external providers through the online [Comfy API](https://docs.comfy.org/tutorials/api-nodes/overview) disable with: --disable-api-nodes - [Config file](extra_model_paths.yaml.example) to set the search paths for models. Workflow examples can be found on the [Examples page](https://comfyanonymous.github.io/ComfyUI_examples/) ## Release Process ComfyUI follows a weekly release cycle targeting Monday but this regularly changes because of model releases or large changes to the codebase. There are three interconnected repositories: 1. **[ComfyUI Core](https://github.com/comfyanonymous/ComfyUI)** - Releases a new stable version (e.g., v0.7.0) roughly every week. - Starting from v0.4.0 patch versions will be used for fixes backported onto the current stable release. - Minor versions will be used for releases off the master branch. - Patch versions may still be used for releases on the master branch in cases where a backport would not make sense. - Commits outside of the stable release tags may be very unstable and break many custom nodes. - Serves as the foundation for the desktop release 2. **[ComfyUI Desktop](https://github.com/Comfy-Org/desktop)** - Builds a new release using the latest stable core version 3. **[ComfyUI Frontend](https://github.com/Comfy-Org/ComfyUI_frontend)** - Weekly frontend updates are merged into the core repository - Features are frozen for the upcoming core release - Development continues for the next release cycle ## Shortcuts | Keybind | Explanation | |------------------------------------|--------------------------------------------------------------------------------------------------------------------| | Ctrl + Enter | Queue up current graph for generation | | Ctrl + Shift + Enter | Queue up current graph as first for generation | | Ctrl + Alt + Enter | Cancel current generation | | Ctrl + Z/Ctrl + Y | Undo/Redo | | Ctrl + S | Save workflow | | Ctrl + O | Load workflow | | Ctrl + A | Select all nodes | | Alt + C | Collapse/uncollapse selected nodes | | Ctrl + M | Mute/unmute selected nodes | | Ctrl + B | Bypass selected nodes (acts like the node was removed from the graph and the wires reconnected through) | | Delete/Backspace | Delete selected nodes | | Ctrl + Backspace | Delete the current graph | | Space | Move the canvas around when held and moving the cursor | | Ctrl/Shift + Click | Add clicked node to selection | | Ctrl + C/Ctrl + V | Copy and paste selected nodes (without maintaining connections to outputs of unselected nodes) | | Ctrl + C/Ctrl + Shift + V | Copy and paste selected nodes (maintaining connections from outputs of unselected nodes to inputs of pasted nodes) | | Shift + Drag | Move multiple selected nodes at the same time | | Ctrl + D | Load default graph | | Alt + + | Canvas Zoom in | | Alt + - | Canvas Zoom out | | Ctrl + Shift + LMB + Vertical drag | Canvas Zoom in/out | | P | Pin/Unpin selected nodes | | Ctrl + G | Group selected nodes | | Q | Toggle visibility of the queue | | H | Toggle visibility of history | | R | Refresh graph | | F | Show/Hide menu | | . | Fit view to selection (Whole graph when nothing is selected) | | Double-Click LMB | Open node quick search palette | | Shift + Drag | Move multiple wires at once | | Ctrl + Alt + LMB | Disconnect all wires from clicked slot | Ctrl can also be replaced with Cmd instead for macOS users # Installing ## Windows Portable There is a portable standalone build for Windows that should work for running on Nvidia GPUs or for running on your CPU only on the [releases page](https://github.com/comfyanonymous/ComfyUI/releases). ### [Direct link to download](https://github.com/comfyanonymous/ComfyUI/releases/latest/download/ComfyUI_windows_portable_nvidia.7z) Simply download, extract with [7-Zip](https://7-zip.org) or with the windows explorer on recent windows versions and run. For smaller models you normally only need to put the checkpoints (the huge ckpt/safetensors files) in: ComfyUI\models\checkpoints but many of the larger models have multiple files. Make sure to follow the instructions to know which subfolder to put them in ComfyUI\models\ If you have trouble extracting it, right click the file -> properties -> unblock The portable above currently comes with python 3.13 and pytorch cuda 13.0. Update your Nvidia drivers if it doesn't start. #### Alternative Downloads: [Experimental portable for AMD GPUs](https://github.com/comfyanonymous/ComfyUI/releases/latest/download/ComfyUI_windows_portable_amd.7z) [Portable with pytorch cuda 12.8 and python 3.12](https://github.com/comfyanonymous/ComfyUI/releases/latest/download/ComfyUI_windows_portable_nvidia_cu128.7z). [Portable with pytorch cuda 12.6 and python 3.12](https://github.com/comfyanonymous/ComfyUI/releases/latest/download/ComfyUI_windows_portable_nvidia_cu126.7z) (Supports Nvidia 10 series and older GPUs). #### How do I share models between another UI and ComfyUI? See the [Config file](extra_model_paths.yaml.example) to set the search paths for models. In the standalone windows build you can find this file in the ComfyUI directory. Rename this file to extra_model_paths.yaml and edit it with your favorite text editor. ## [comfy-cli](https://docs.comfy.org/comfy-cli/getting-started) You can install and start ComfyUI using comfy-cli: %%CODEBLOCK0%% ## Manual Install (Windows, Linux) Python 3.14 works but you may encounter issues with the torch compile node. The free threaded variant is still missing some dependencies. Python 3.13 is very well supported. If you have trouble with some custom node dependencies on 3.13 you can try 3.12 torch 2.4 and above is supported but some features and optimizations might only work on newer versions. We generally recommend using the latest major version of pytorch with the latest cuda version unless it is less than 2 weeks old. ### Instructions: Git clone this repo. Put your SD checkpoints (the huge ckpt/safetensors files) in: models/checkpoints Put your VAE in: models/vae ### AMD GPUs (Linux) AMD users can install rocm and pytorch with pip if you don't have it already installed, this is the command to install the stable version: `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.4%%CODEBLOCK1%%pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm7.1%%CODEBLOCK2%%pip install --pre torch torchvision torchaudio --index-url https://rocm.nightlies.amd.com/v2/gfx110X-all/%%CODEBLOCK3%%pip install --pre torch torchvision torchaudio --index-url https://rocm.nightlies.amd.com/v2/gfx1151/%%CODEBLOCK4%%pip install --pre torch torchvision torchaudio --index-url https://rocm.nightlies.amd.com/v2/gfx120X-all/%%CODEBLOCK5%%pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu%%CODEBLOCK6%%pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/xpu%%CODEBLOCK7%%pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130%%CODEBLOCK8%%pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu130%%CODEBLOCK9%%pip uninstall torch%%CODEBLOCK10%%pip install -r requirements.txt%%CODEBLOCK11%%bash pip install -r manager_requirements.txt %%CODEBLOCK12%%bash python main.py --enable-manager %%CODEBLOCK13%%python main.py%%CODEBLOCK14%%HSA_OVERRIDE_GFX_VERSION=10.3.0 python main.py%%CODEBLOCK15%%HSA_OVERRIDE_GFX_VERSION=11.0.0 python main.py%%CODEBLOCK16%%TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 python main.py --use-pytorch-cross-attention%%CODEBLOCK17%%embedding:embedding_filename.pt%%CODEBLOCK18%%--preview-method auto` to enable previews. The default installation includes a fast latent preview method that's low-resolution. To enable higher-quality previews with [TAESD](https://github.com/madebyollin/taesd), download the [taesd_decoder.pth, taesdxl_decoder.pth, taesd3_decoder.pth and taef1_decoder.pth](https://github.com/madebyollin/taesd/) and place them in the models/vae_approx folder. Once they're installed, restart ComfyUI and launch it with --preview-method taesd to enable high-quality previews. ## How to use TLS/SSL? Generate a self-signed certificate (not appropriate for shared/production use) and key by running the command: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname" Use --tls-keyfile key.pem --tls-certfile cert.pem to enable TLS/SSL, the app will now be accessible with https://... instead of http://.... > Note: Windows users can use [alexisrolland/docker-openssl](https://github.com/alexisrolland/docker-openssl) or one of the [3rd party binary distributions](https://wiki.openssl.org/index.php/Binaries) to run the command example above. <br/><br/>If you use a container, note that the volume mount -v can be a relative path so ... -v ".\:/openssl-certs" ... would create the key & cert files in the current directory of your command prompt or powershell terminal. ## Support and dev channel [Discord](https://comfy.org/discord): Try the #help or #feedback channels. [Matrix space: #comfyui_space:matrix.org](https://app.element.io/#/room/%23comfyui_space%3Amatrix.org) (it's like discord but open source). See also: [https://www.comfy.org/](https://www.comfy.org/) ## Frontend Development As of August 15, 2024, we have transitioned to a new frontend, which is now hosted in a separate repository: [ComfyUI Frontend](https://github.com/Comfy-Org/ComfyUI_frontend). This repository now hosts the compiled JS (from TS/Vue) under the web/ directory. ### Reporting Issues and Requesting Features For any bugs, issues, or feature requests related to the frontend, please use the [ComfyUI Frontend repository](https://github.com/Comfy-Org/ComfyUI_frontend). This will help us manage and address frontend-specific concerns more efficiently. ### Using the Latest Frontend The new frontend is now the default for ComfyUI. However, please note: 1. The frontend in the main ComfyUI repository is updated fortnightly. 2. Daily releases are available in the separate frontend repository. To use the most up-to-date frontend version: 1. For the latest daily release, launch ComfyUI with this command line argument: %%CODEBLOCK19%% 2. For a specific version, replace latest` with the desired version number:
--front-end-version Comfy-Org/ComfyUI_frontend@1.2.2

This approach allows you to easily switch between the stable fortnightly release and the cutting-edge daily updates, or even specific versions for testing purposes.

Accessing the Legacy Frontend

If you need to use the legacy frontend for any reason, you can access it using the following command line argument:

--front-end-version Comfy-Org/ComfyUI_legacy_frontend@latest

This will use a snapshot of the legacy frontend preserved in the ComfyUI Legacy Frontend repository.

QA

Which GPU should I buy for this?

See this page for some recommendations