当前位置: 首页 > news >正文

ComfyUI - 在服务器中部署 AIGC 绘画的 ComfyUI 工具 教程

欢迎关注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://spike.blog.csdn.net/article/details/141140498

免责声明:本文来源于个人知识与公开资料,仅用于学术交流,欢迎讨论,不支持转载。


ComfyUI

ComfyUI 是功能强大且高度模块化的 AI 绘画工具,基于 Stable Diffusion 技术,采用节点式工作流界面,使用户能够更直观地控制图像生成过程。特点是模块化设计,允许用户通过拖放节点来创建和调整工作流,极大地提高了灵活性和可定制性。速度更快,灵活的组建工作流,专业团队的需求,节点式编辑。

GitHub: https://github.com/comfyanonymous/ComfyUI

git clone https://github.com/comfyanonymous/ComfyUI

配置 conda 环境

conda create -n comfyui python=3.9
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
pip install numpy==1.26.4

Numpy 必须是 1.x 版本,否则报错:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.

安装其他库:

pip install -r requirements.txt

启动任务,默认端口是 8188:

python3 main.py --listen 0.0.0.0
# nohup python3 -u main.py --listen 0.0.0.0 > nohup.run_main.out &
# ps -aux | grep "main.py"
# kill -9 [pid]

启动成功的日志,例如 http://[your ip]:8188/:

Total VRAM 81052 MB, total RAM 1031523 MB
pytorch version: 1.13.1+cu117
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA A100-SXM4-80GB : 
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
[Prompt Server] web root: workspace_comfyui/ComfyUI/webImport times for custom nodes:0.0 seconds: workspace_comfyui/ComfyUI/custom_nodes/websocket_image_save.pyStarting serverTo see the GUI go to: http://0.0.0.0:8188

ComfyUI 启动成功:

ComfyUI

ComfyUI 支持复用 Stable Diffusion WebUI 的配置,修改 extra_model_paths.yaml

a111:base_path: workspace/stable_diffusion_webui/checkpoints: models/Stable-diffusionconfigs: models/Stable-diffusionvae: models/VAEloras: |models/Loramodels/LyCORISupscale_models: |models/ESRGANmodels/RealESRGANmodels/SwinIRembeddings: embeddingshypernetworks: models/hypernetworkscontrolnet: extensions/sd-webui-controlnet/models

注意:需要修改 controlnet 的默认模型路径,这个部分与默认不一致,其他逐个验证即可。

workspace_comfyui/ComfyUI/custom_nodes 文件夹中,安装自定义 ComfyUI-Manager 插件:

  • ComfyUI-Manager: https://github.com/ltdrdata/ComfyUI-Manager

custom_nodes

第 1 次启动时,需要等待安装配置,## ComfyUI-Manager: installing dependencies. (GitPython)

安装翻译插件:AIGODLIKE-ComfyUI-Translation,重启服务即可:

cd custom_nodes
git clone https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git

将 ComfyUI 页面翻译成中文:

ComfyUI

点击 Queue Prompt,即可运行程序。

Queue Prompt

提示词:

  • beautiful scenery nature glass bottle landscape, purple galaxy bottle,
  • 美丽的风景自然玻璃瓶景观,紫色银河瓶。

如图所示:

Image

运行报错:

  File "workspace_comfyui/ComfyUI/custom_nodes/ComfyUI-Manager/glob/manager_server.py", line 1710, in <lambda>threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()File "envs/comfyui/lib/python3.9/asyncio/runners.py", line 44, in runreturn loop.run_until_complete(main)File "aiohttp/client_reqrep.py", line 1014, in startself._continue = NoneFile "aiohttp/helpers.py", line 713, in __exit__raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

原因是 GitHub 国内访问异常,使用代理即可,参考源码 ComfyUI-Manager/glob/manager_server.py#1688,即:

async def default_cache_update():async def get_cache(filename):# uri = 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/' + filenameuri = 'https://mirror.ghproxy.com/https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/' + filenamecache_uri = str(core.simple_hash(uri)) + '_' + filenamecache_uri = os.path.join(core.cache_dir, cache_uri)json_obj = await core.get_data(uri, True)with core.cache_lock:with open(cache_uri, "w", encoding='utf-8') as file:json.dump(json_obj, file, indent=4, sort_keys=True)print(f"[ComfyUI-Manager] default cache updated: {uri}")a = get_cache("custom-node-list.json")b = get_cache("extension-node-map.json")c = get_cache("model-list.json")d = get_cache("alter-list.json")e = get_cache("github-stats.json")await asyncio.gather(a, b, c, d, e)threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()

修改 uri,增加 https://mirror.ghproxy.com/ 前缀,即可

参考:https://github.com/runningcheese/MirrorSite

http://www.lryc.cn/news/425667.html

相关文章:

  • MySQL中的distinct和group by哪个效率更高?
  • STM32F103C8T6单片机原理图设计(PCB板)
  • Qt自定义控件:关于大佬“飞扬青云“的自定义UI控件的使用教程(MinGw,MSVC)
  • 关于RCE
  • 深入理解npm:从入门到精通
  • Docker入门教程:10分钟掌握基础
  • NLP实验-基于预训练模型的文本分类
  • Table API SQL的概念和通用API
  • 【网络】UDP和TCP之间的差别和回显服务器
  • Electron:摄像头录制和屏幕录制
  • 【uniapp】vue3+vite配置tailwindcss
  • 从源码到应用:医疗陪诊系统与在线问诊小程序开发详解
  • mysql数据库中decimal数据类型比较大小
  • 掌控库存,简化管理 — InvenTree 开源库存管理系统
  • Linux---项目自动化构建工具-make/Makefile
  • 嘉立创EDA个人学习笔记1(PCB板介绍)
  • (转)Restful接口设计(1)
  • Python进阶之3D图形
  • 机器学习深度学习中的搜索算法浅谈
  • 基于IMX8M_plus+FPGA+AI监护仪解决方案
  • 仿RabbitMq实现简易消息队列正式篇(路由匹配篇)
  • 一套完整的NVR网络硬盘录像机解决方案和NVR程序源码介绍
  • 2024年人工智能固态硬盘采购容量预计超过45 EB
  • Java的反射原理
  • vue.config.js 配置
  • C ++ 也可以搭建Web?高性能的 C++ Web 开发框架 CPPCMS + MySQL 实现快速入门案例
  • Taos 常用命令工作笔记(二)
  • idea安装二进制文本阅读插件
  • MySQL 常用 SQL 语句大全
  • [Spring] Spring事务与事务的传播