惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
T
Tenable Blog
T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
C
CERT Recently Published Vulnerability Notes
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Vercel News
Vercel News
P
Palo Alto Networks Blog
N
News and Events Feed by Topic
Simon Willison's Weblog
Simon Willison's Weblog
L
LINUX DO - 最新话题
阮一峰的网络日志
阮一峰的网络日志
C
CXSECURITY Database RSS Feed - CXSecurity.com
Google DeepMind News
Google DeepMind News
Project Zero
Project Zero
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
The Last Watchdog
The Last Watchdog
博客园_首页
D
Docker
MyScale Blog
MyScale Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Hacker News
The Hacker News
云风的 BLOG
云风的 BLOG
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
The Blog of Author Tim Ferriss
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
S
Schneier on Security
C
Check Point Blog
I
Intezer
S
Securelist
雷峰网
雷峰网
小众软件
小众软件
C
Cyber Attacks, Cyber Crime and Cyber Security
PCI Perspectives
PCI Perspectives
S
Security @ Cisco Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
量子位
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
A
About on SuperTechFans
T
Troy Hunt's Blog
Google Online Security Blog
Google Online Security Blog
F
Fortinet All Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
Security Archives - TechRepublic
Security Archives - TechRepublic
Latest news
Latest news

侯锐的思考与分享

大数据技术的演进:从 Hive、GFS 到 Raft 如何进行站点网络优化 使用Elasticsearch分析腾讯云EO日志 XXL-JOB的部署、搭建与使用 使用NGINX的auth_request进行统一jwt鉴权 使用APISIX解析jwt并获取payload信息 《推荐系统实践》 《上瘾:让用户养成使用习惯的四大产品逻辑》 Kotlin与Java对照手册 ComfyUI的操作与使用 利用whisper为视频自动生成字幕 ffmpeg笔记 如何参与Apache顶级开源项目 使用frp实现内网ssh穿透 安装并使用zsh APISIX的使用 自己动手实现一个可以运行在JVM上的编程语言 使用ANTLR4格式化JSON ANTLR4从入门到实践 ShardingSphere-JDBC介绍 Maven详细介绍
ComfyUI简介
Raymond · 2025-03-31 · via 侯锐的思考与分享

ComfyUI 是一个基于节点工作流的现代化 Stable Diffusion 图形用户界面。与传统的WebUI不同,ComfyUI采用节点连接的方式来构建图像生成工作流,让用户能够更精确地控制整个生成过程。

Stable Diffusion 是一款开源的 AI 图像生成技术,基于扩散模型构建。用户可以通过 Stable Diffusion WebUIComfyUI 等开源工具来运行它,只需下载相应的模型文件(通常为 .ckpt.safetensors 格式)即可开始使用。

核心概念

ComfyUI中的图像生成涉及三个关键组件,在CheckpointLoader中进行设置:

  • CLIP:将文本提示转化为主模型可以理解的向量形式
  • 主模型(Main MODEL):执行实际的图像生成计算
  • VAE(变分自编码器):将主模型的潜在空间格式转化为最终可视的图片

安装和配置

1. 下载和安装

GitHub 下载对应版本,解压后运行:

  • run_nvidia_gpu.bat(推荐NVIDIA GPU用户)
  • ./python_embeded/python -s ComfyUI/main.py --windows-standalone-build

2. 安装管理器和插件

下载 ComfyUI-Manager 放到 ComfyUI/custom_nodes 文件夹,然后在Manager的Custom Node Manager中安装所需插件(需要科学上网)。

3. 下载模型

将模型文件放置到 ComfyUI/models 文件夹中:

  • Checkpoint模型checkpoints 文件夹
  • LoRA模型loras 文件夹
  • VAE模型vae 文件夹

推荐入门模型:SD 1.5

模型资源网站:

4. 网络配置

如果遇到网络连接问题,可以使用SwitchHosts添加以下配置:

1
2
3
4
185.199.108.133 raw.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com

扩展功能

ComfyUI_StoryDiffusion

通过Custom Node Manager安装,然后执行以下命令安装依赖:

1
2
./python_embeded/python.exe -m pip install -r ../ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI_StoryDiffusion/requirements.txt
./python_embeded/python.exe -m pip install opencv-python

API操作

HTTP API方式

  1. 启用开发者选项
  2. 将设置好的Workflow导出为API格式
  3. 创建任务:
    1
    2
    3
    curl -X POST 'http://127.0.0.1:8188/prompt' \
    -H 'Content-Type: application/json' \
    -d '{"prompt": API文件的内容}'
  4. 查询结果:curl -X GET 'http://127.0.0.1:8188/history/{prompt_id}'
  5. 获取图片:http://127.0.0.1:8188/view?filename=ComfyUI_00003_.png&subfolder&type=output

WebSocket方式

更简单的实时通信方式:

1
2
3
4
5

ws:


{"client_id": "23333", "prompt": "API文件的内容"}

提示:如果不想折腾本地环境,可以考虑使用腾讯云等平台提供的按时计费ComfyUI服务。

参考资料

官方资源

学习教程

本文链接: https://www.nosuchfield.com/2025/03/30/ComfyUI-Introduction/