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

打印 上一主题 下一主题

主题 1630|帖子 1630|积分 4900

欢迎关注我的CSDN:https://spike.blog.csdn.net/
本文地点:https://spike.blog.csdn.net/article/details/141140498
  免责声明:本文来源于个人知识与公开资料,仅用于学术交流,欢迎讨论,不支持转载。


ComfyUI 是功能强盛且高度模块化的 AI 绘画工具,基于 Stable Diffusion 技能,采用节点式工作流界面,使用户可以或许更直观地控制图像天生过程。特点是模块化设计,允许用户通过拖放节点来创建和调整工作流,极大地进步了机动性和可定制性。速度更快,机动的组建工作流,专业团队的需求,节点式编辑。
GitHub: https://github.com/comfyanonymous/ComfyUI
  1. git clone https://github.com/comfyanonymous/ComfyUI
复制代码
设置 conda 情况
  1. conda create -n comfyui python=3.9
  2. 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
  3. pip install numpy==1.26.4
复制代码
Numpy 必须是 1.x 版本,否则报错:
  1. A module that was compiled using NumPy 1.x cannot be run in
  2. NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
  3. versions of NumPy, modules must be compiled with NumPy 2.0.
复制代码
安装其他库:
  1. pip install -r requirements.txt
复制代码
启动使命,默认端口是 8188:
  1. python3 main.py --listen 0.0.0.0
  2. # nohup python3 -u main.py --listen 0.0.0.0 > nohup.run_main.out &
  3. # ps -aux | grep "main.py"
  4. # kill -9 [pid]
复制代码
启动乐成的日志,比方 http://[your ip]:8188/:
  1. Total VRAM 81052 MB, total RAM 1031523 MB
  2. pytorch version: 1.13.1+cu117
  3. Set vram state to: NORMAL_VRAM
  4. Device: cuda:0 NVIDIA A100-SXM4-80GB :
  5. Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
  6. [Prompt Server] web root: workspace_comfyui/ComfyUI/web
  7. Import times for custom nodes:
  8.    0.0 seconds: workspace_comfyui/ComfyUI/custom_nodes/websocket_image_save.py
  9. Starting server
  10. To see the GUI go to: http://0.0.0.0:8188
复制代码
ComfyUI 启动乐成:

ComfyUI 支持复用 Stable Diffusion WebUI 的设置,修改 extra_model_paths.yaml:
  1. a111:
  2.     base_path: workspace/stable_diffusion_webui/
  3.     checkpoints: models/Stable-diffusion
  4.     configs: models/Stable-diffusion
  5.     vae: models/VAE
  6.     loras: |
  7.          models/Lora
  8.          models/LyCORIS
  9.     upscale_models: |
  10.                   models/ESRGAN
  11.                   models/RealESRGAN
  12.                   models/SwinIR
  13.     embeddings: embeddings
  14.     hypernetworks: models/hypernetworks
  15.     controlnet: extensions/sd-webui-controlnet/models
复制代码
  注意:需要修改 controlnet 的默认模子路径,这个部门与默认不一致,其他逐个验证即可。
  在 workspace_comfyui/ComfyUI/custom_nodes 文件夹中,安装自定义 ComfyUI-Manager 插件:


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

   第 1 次启动时,需要等待安装设置,## ComfyUI-Manager: installing dependencies. (GitPython)
  安装翻译插件:AIGODLIKE-ComfyUI-Translation,重启服务即可:
  1. cd custom_nodes
  2. git clone https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git
复制代码
将 ComfyUI 页面翻译成中文:

点击 Queue Prompt,即可运行步伐。

提示词:


  • beautiful scenery nature glass bottle landscape, purple galaxy bottle,
  • 美丽的风景天然玻璃瓶景观,紫色银河瓶。
如图所示:

运行报错:
  1.   File "workspace_comfyui/ComfyUI/custom_nodes/ComfyUI-Manager/glob/manager_server.py", line 1710, in <lambda>
  2.     threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()
  3.   File "envs/comfyui/lib/python3.9/asyncio/runners.py", line 44, in run
  4.     return loop.run_until_complete(main)
  5.         File "aiohttp/client_reqrep.py", line 1014, in start
  6.     self._continue = None
  7.   File "aiohttp/helpers.py", line 713, in __exit__
  8.     raise asyncio.TimeoutError from None
  9. asyncio.exceptions.TimeoutError
复制代码
原因是 GitHub 国内访问异常,使用代理即可,参考源码 ComfyUI-Manager/glob/manager_server.py#1688,即:
  1. async def default_cache_update():
  2.     async def get_cache(filename):
  3.         # uri = 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/' + filename
  4.         uri = 'https://mirror.ghproxy.com/https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/' + filename
  5.         cache_uri = str(core.simple_hash(uri)) + '_' + filename
  6.         cache_uri = os.path.join(core.cache_dir, cache_uri)
  7.         json_obj = await core.get_data(uri, True)
  8.         with core.cache_lock:
  9.             with open(cache_uri, "w", encoding='utf-8') as file:
  10.                 json.dump(json_obj, file, indent=4, sort_keys=True)
  11.                 print(f"[ComfyUI-Manager] default cache updated: {uri}")
  12.     a = get_cache("custom-node-list.json")
  13.     b = get_cache("extension-node-map.json")
  14.     c = get_cache("model-list.json")
  15.     d = get_cache("alter-list.json")
  16.     e = get_cache("github-stats.json")
  17.     await asyncio.gather(a, b, c, d, e)
  18. threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()
复制代码
修改 uri,增加 https://mirror.ghproxy.com/ 前缀,即可
参考:https://github.com/runningcheese/MirrorSite

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

来自云龙湖轮廓分明的月亮

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表