【大模型系列篇】ComfyUI一键安装部署教程

如何安装ComfyUI是不是难倒了一众想体验的玩家,当然使用官方提供的整合包或者使用秋叶的一键启动器也是非常简单的。但是这次我们来体验下Docker一键安装部署的快感。

当然首先我们需要在宿主机上安装好Docker以及需要让容器能访问到宿主机的GPU资源,大家可以参考之前整理的《GPU资源容器化访问使用指南》一步一步操作。

ComfyUI

ComfyUI是一个为Stable Diffusion专门设计的基于节点的图形用户界面(GUI)。它使用户能够通过链接不同的块(称为节点)来构建复杂的图像生成工作流程。这些节点可以包括各种任务,如加载检查点模型、输入提示、指定采样器等。它实际上就是一个比较专业的Stable Diffusion运行界面,只不过是节点式的。

官方地址:https://github.com/comfyanonymous/ComfyUI

WebUI与ComfyUI对比

ComfyUI提供了极高的自由度和灵活性,支持高度的定制化和工作流复用,同时对系统配置的要求较低,并且能够加快原始图像的生成速度。然而,由于它拥有众多的插件节点,以及较为复杂的操作流程,学习起来相对困难。

另一方面,WebUI特点是拥有固定的操作界面,使得其易于学习和快速上手。经过一年多的发展,它已经建立了一个成熟且稳定的开源生态系统。但相比ComfyUI,在性能方面可能稍逊一筹,且在工作流程复制方面存在局限性,用户需在每次操作时手动进行设置。

因此,建议初学者从WebUI开始入手《文生图stable-diffusion-webui安装入门教程》,熟悉后再考虑转向ComfyUI,以充分利用AI工作流程,实现效率的最大化。

Docker安装ComfyUI

在此感谢@YanWenKun大佬提供的ComfyUI基础镜像

镜像地址:docker pull yanwk/comfyui-boot:cu124-cn

项目来源:https://github.com/YanWenKun/ComfyUI-Docker

  • 镜像包含的内容

  • 拉取镜像
    docker pull dockerproxy.net/yanwk/comfyui-boot:cu124-cn
  • 定义工作空间
    /data/workspace
  • 启动镜像容器

    cd /data/workspace
    mkdir -p storage
    
    docker run -it --rm \
      --name comfyui-cn \
      --gpus all \
      -p 8188:8188 \
      -v "$(pwd)"/storage:/root \
      -e CLI_ARGS="--fast" \
      -e PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" \
      -e HF_ENDPOINT="https://hf-mirror.com" \
      yanwk/comfyui-boot:cu124-cn

启动报错问题  

排查问题,发现是ghp.ci失效了,我们替换只新地址ghgo.xyz,查看地址: https://ghproxy.link 

  • 下载代码查看
    # git clone https://github.com/YanWenKun/ComfyUI-Docker
    https://github.com/YanWenKun/ComfyUI-Docker/tree/main/cu124-cn/runner-scripts

    ghp.ci替换ghgo.xyz   

    # ls -l
    -rw-r--r--. 1 root root   29 12月 19 17:26 comfy.settings.json.example
    -rw-r--r--. 1 root root 3647 12月 19 17:37 download-models.txt
    -rw-r--r--. 1 root root 5068 12月 19 17:37 download.sh
    -rw-r--r--. 1 root root 1399 12月 19 17:26 entrypoint.sh
    -rw-r--r--. 1 root root 1976 12月 19 17:35 minimal-start.sh
    -rw-r--r--. 1 root root   66 12月 19 17:26 pre-start.sh.example
    -rw-r--r--. 1 root root  904 12月 19 17:26 set-proxy.sh.example
    
    # grep -rl1 'ghp.ci' .
    ./download-models.txt
    ./download.sh
    ./minimal-start.sh
    
    # sed -i 's/ghp.ci/ghgo.xyz/g' download-models.txt
    # sed -i 's/ghp.ci/ghgo.xyz/g' download.sh
    # sed -i 's/ghp.ci/ghgo.xyz/g' minimal-start.sh
  • 构建 Dockerfile和镜像 
    FROM yanwk/comfyui-boot:cu124-cn
    
    RUN rm -rf /runner-scripts/
    COPY runner-scripts/.  /runner-scripts/
    docker build -t qz/comfyui-boot:cu124-cn
  •  重新启动新镜像容器
    cd /data/workspace
    
    docker run -it --rm \
      --name comfyui-cn \
      --gpus all \
      -p 8188:8188 \
      -v "$(pwd)"/storage:/root \
      -e CLI_ARGS="--fast" \
      -e PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" \
      -e HF_ENDPOINT="https://hf-mirror.com" \
      qz/comfyui-boot:cu124-cn

  • 下载模型成功  

  • 导入自定义节点成功

我们发现有个别是失败的,需要的时候,我们可以单独下载至外设路径 storge 的 ComfyUI/custom_nodes。 

ComfyUI体验效果

提示词
a bottle with a beautiful rainbow galaxy inside it on top of a wooden table 
in the middle of a modern kitchen beside a plate of vegetables and mushrooms 
and a wine glasse that contains a planet earth with a plate with 
a half eaten apple pie on it.
效果

我们可以下载更多的工作流模版来体验不一样的效果,https://comfyworkflows.com

ComfyUI-AuraFlow-v0.3模型体验

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

木亦汐丫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值