跳到正文
DEV Community· Muhammad Tayyab·· 5 小時前AI 評分66

ComfyUI:本地 AI 圖像、影片與 3D 生成的開源節點圖引擎(141K Stars)

ComfyUI: The Open-Source Node-Graph Engine for Local AI Images, Video and 3D (141K Stars)

AI 導讀

ComfyUI 是免費開源的本地 AI 生成引擎,透過節點圖工作流支援圖像、影片、音訊、3D 模型及文字生成。工作流只會重算有變動的部分,並可嵌入生成媒體;載入 ComfyUI 產生的 PNG 可還原節點圖及種子。README 指其可在 4GB VRAM 和 8GB RAM 下相對快速地運行最大型開源模型,但這配置不會達到 24GB 顯示卡的速度。

正文

What Is ComfyUI?

ComfyUI is a free, open-source engine for generating images, video, audio, 3D models and text with AI models that run on your own hardware. Instead of a form with a prompt box and a Generate button, it gives you a canvas of nodes: one loads a model, one encodes your prompt, one samples, one decodes the result into pixels, one saves the file. You wire them together, and the wiring is the program.

The project describes itself as "the most powerful and modular AI engine for content creation", and the adoption behind that line is real: more than 141,000 GitHub stars, nearly 17,000 forks, a GPL-3.0 license and a release roughly every week. It runs on Windows, Linux and macOS as a desktop app, a portable build or a manual Python install, and there is a paid Comfy Cloud for people without a capable GPU.

It began in early 2023 as an interface for Stable Diffusion, and the list of what it runs now shows how far it has moved past that: Flux, SD3.5 and Qwen Image for pictures, Wan 2.2 and HunyuanVideo for video, ACE-Step and Stable Audio for sound, Hunyuan3D for meshes, and Gemma and Qwen3 for text.

The Graph Is the Program, and It Only Re-Runs What Changed

Most image generators hide the pipeline behind settings. ComfyUI puts it on screen. A basic text-to-image graph is a handful of nodes: a loader for the checkpoint (or for a separate diffusion model, VAE and text encoder, which ComfyUI can load individually), a text-encode node for the positive and negative prompts, a sampler that does the denoising, a VAE decode that turns the result into pixels, and a save node. LoRAs, ControlNets, adapters and upscalers are more nodes dropped in between.

For a single picture that is more work than a prompt box. The payoff comes from three rules in how the graph runs:

  • Only complete paths run. A part of the graph executes only if it ends in an output and every input along the way is connected. A half-built branch just sits there.
  • Only what changed runs again. Submit the same graph twice and the second run does nothing. Change the last node, and only that node and whatever depends on it are recomputed. Swap the upscaler and you keep the sampled image you already waited for.
  • Bypass and mute are built in. Ctrl+B bypasses a node, as if it were removed and the wires reconnected through it, and Ctrl+M mutes it, so you can compare a pipeline with and without a step without rewiring anything.

The second rule is the one that changes how you work. In a form-based tool, adjusting the final step means generating again from scratch. In ComfyUI an expensive video sample is computed once while you iterate on everything downstream of it.

Every Image Carries Its Own Recipe

ComfyUI saves workflows as JSON, and it also writes the workflow into the media it generates. Drag a PNG that ComfyUI made back onto the canvas and you get the whole graph that produced it, seeds included. This is why ComfyUI workflows travel so well: someone posts a striking image and the image itself is the tutorial.

For handing a finished pipeline to people who should not touch the wiring, App Mode exposes even an elaborate workflow through a simple interface, and reusable subgraphs fold a cluster of nodes into one. For software, the same graphs are reachable through a local API, which is how ComfyUI ends up inside production pipelines and not only on artists' desktops.

Big Models on Small GPUs

The claim that gets ComfyUI recommended to people with modest hardware sits in the first lines of its README: it "can run even the biggest open source models on as low as 4GB vram + 8GB ram relatively quickly", using asynchronous weight streaming, alongside smart VRAM and RAM management, model offloading and support for quantized models. In other words, the whole model does not have to fit on the graphics card at once.

Take the word "relatively" seriously. A model streaming through 4GB of VRAM will be slower than the same model sitting on a 24GB card. What ComfyUI promises is that it runs and keeps the GPU busy, not that a budget card matches a flagship.

Hardware support is unusually broad. NVIDIA works out of the box. AMD works through ROCm on Linux and, on Windows 11, through AMD's ROCm 10 PyTorch packages. Intel Arc runs on PyTorch's xpu backend, Apple Silicon on PyTorch nightly, and there are instructions for Ascend NPUs, Cambricon MLUs and Iluvatar Corex as well. One trap: the default Windows portable build targets NVIDIA 20 series cards and newer, and 10 series and older cards need the separate CUDA 12.6 build.

What It Generates in 2026

  • Images: SD 1.5, SDXL, SD3.5, Flux.1 and Flux.2, Qwen Image, HiDream, Chroma and more.
  • Image editing: Flux Kontext, Qwen Image Edit, OmniGen2 and others.
  • Video: Wan 2.1 and 2.2, LTX-Video 2, HunyuanVideo 1.5, CogVideoX and Mochi.
  • Audio: ACE-Step 1.5 and Stable Audio 3.
  • 3D and vision: Hunyuan3D 2.1, SAM 3, Depth Anything 3 and SUPIR upscaling.
  • Text: Gemma 3 and 4 and the Qwen3 family, including multimodal inputs.

Around those models sit built-in nodes for inpainting, outpainting, masks and compositing, model merging, upscaling, frame interpolation, segmentation and depth estimation. Output goes beyond the 8-bit PNG most generators stop at: 16-bit PNG, 32-bit EXR, 10-bit AVIF and HDR video.

Installing ComfyUI: Desktop, Portable or Manual

There are four routes, and the README is clear about which one most people should take.

  • Desktop app (Windows and macOS): the recommended way for new users, downloaded from comfy.org/download.
  • Windows portable: download, extract with 7-Zip (or Windows Explorer on recent versions) and run. It ships Python 3.13 and PyTorch with CUDA 13.0, with separate builds for AMD, Intel and older NVIDIA cards.
  • comfy-cli: pip install comfy-cli, then comfy install.
  • Manual install (any OS, any GPU): clone the repo, install PyTorch for your GPU, then the dependencies, then start it.

Checkpoints go in models/checkpoints and VAEs in models/vae. Python 3.13 is the well-supported version; 3.14 works, but some custom nodes may not.

If you already have another Stable Diffusion interface with a folder full of models, you do not need to copy gigabytes of checkpoints. Rename extra_model_paths.yaml.example to extra_model_paths.yaml and point it at your existing folders.

Custom Nodes and ComfyUI-Manager

Much of ComfyUI's reach comes from custom nodes: third-party packages that add support for new models, utilities and integrations. ComfyUI-Manager is the extension that installs, updates and manages them.

Two cautions. Custom nodes are Python code that runs with your user's permissions, so install them from sources you trust, the same way you would treat any package. And mind the release train: core ships a stable version roughly every two weeks, and the README warns that commits between stable tags "may be very unstable and break many custom nodes". If your workflows lean on a lot of third-party nodes, stay on the stable releases.

Offline First, Paid Models Optional

ComfyUI's core "does not download anything unless you request it". That matters for anyone working with client material or unreleased designs: prompts, images and models stay on the machine.

The optional exception is partner nodes, which call paid closed-source models such as Nano Banana, Seedance and Hunyuan3D through Comfy's API. Two flags control them: --offline disables them and forces everything built in to stay local, and --disable-partner-nodes turns off only those nodes. Comfy Cloud, the paid hosted version, is the other way to spend money, aimed at people without suitable hardware.

Prompt Syntax Worth Knowing

  • Emphasis: wrap a phrase in parentheses with a weight, such as (good code:1.2) or (bad code:0.8). Plain parentheses mean 1.1.
  • Wildcards: {day|night} is replaced by one of the options at random each time you queue, which is a cheap way to generate variations.
  • Comments: dynamic prompts accept C-style // comments and /* block comments */.
  • Embeddings: put textual inversion files in models/embeddings and reference them in a prompt as embedding:filename.

And for previews while sampling, --preview-method auto turns on the fast built-in previews; for higher-quality TAESD previews, add their decoder files to models/vae_approx and start with --preview-method taesd.

Who Should Use It, and Who Can Skip It

ComfyUI is for people who want control and reproducibility: artists building repeatable pipelines, video and 3D creators chaining several models, developers who want a generation backend they can call from their own code, and anyone with a modest GPU who has been told their card is too small. If you generate the same kind of output repeatedly, the graph pays for its learning curve within days.

It is a harder sell if you want one picture from one prompt with zero setup. A hosted generator gets you there faster, and ComfyUI asks you to learn what a sampler, a VAE and a LoRA are, to manage models that run to gigabytes, and to keep custom nodes in step with core releases.

The verdict: ComfyUI has earned its place as the default open-source engine for generative media. The node graph that looks intimidating on day one is the reason it scales, because graphs re-run only what changed, travel inside the images they produce, and can be wrapped in App Mode or called through an API. Install the desktop app, load a template from the workflow library, and change one node at a time.

Frequently Asked Questions

Q: Is ComfyUI free?

A: Yes. ComfyUI is free and open source under the GPL-3.0 license, and it runs locally on your own hardware. The optional costs are Comfy Cloud, a paid hosted version for people without a suitable GPU, and partner nodes, which call paid closed-source models through Comfy's API.

Q: How much VRAM does ComfyUI need?

A: According to the README, ComfyUI can run even the biggest open-source models on as little as 4GB of VRAM and 8GB of system RAM, relatively quickly, by streaming weights to the GPU as they are needed and offloading models.

Q: Does ComfyUI work on Mac and AMD GPUs?

A: Yes. The desktop app runs on macOS, and Apple Silicon (M1 to M4) works with a PyTorch nightly build. AMD GPUs are supported through ROCm on Linux and through AMD's ROCm 10 PyTorch packages on Windows 11. Intel Arc GPUs work through PyTorch's xpu backend.

Q: How do I install custom nodes in ComfyUI?

A: Use ComfyUI-Manager. Install its dependencies, then start ComfyUI with the manager enabled, and install, update or remove custom nodes from its interface. Custom nodes are third-party Python code that runs on your machine, so only install ones from sources you trust.

Q: Can I get the workflow back from a ComfyUI image?

A: Yes. ComfyUI embeds the workflow in the media it generates. Drag a PNG that ComfyUI produced onto the canvas, or load it, and you get the full graph that created it, including the seeds. Workflows can also be saved and loaded as JSON files.


Originally published at devpik.com. GitHub: Comfy-Org/ComfyUI

來源:DEV Community · dev.to