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

ComfyUI节点安装笔记

AI高速发展,版本更新相当快(11月25日才安装的版本v.0.3.4,27日版本就已经更新到v.0.3.5了),在遇到问题,找到问题原因所在的过程中,ComfyUI版本、python版本、节点对环境版本的依赖,本文就是在为了解决自己遇到问题过程中,如何快速安装ComfyUI及节点而作的笔记。

1、安装ComfyUI

方法①:下载 Windows 的可移植独立版本ComfyUI 的某个版本,并解压到某个文件夹,最方便。但Python版本固定,不能选择你想要的Python版本,而有些节点,无法在Python3.12运行,例如下面节点在Python3.12下会出错(在DownloadAndLoadFlorence2Model选择flash_attention_2时的错误信息:FlashAttention only supports Ampere GPUs or newer.  由于我的显卡是20系列,不支持BF16运算,在python3.12的flash_attention中则使用了BF16),在Python3.11则没有问题。

方法②:通过ComfyUI-Manager升级ComfyUI,但只能升级到最新版本,不能升级到指定版本。

方法③:选择①中的Python环境(选择需要的python版本),将ComfyUI文件夹删除,然后用git命令安装指定版本的ComfyUI(直接下载ComfyUI 不同版本的Source code (zip) 解压会少了 .git 文件夹少了版本信息):

git clone -b <版本号> <仓库地址>
git clone -b v0.3.3 https://github.com/comfyanonymous/ComfyUI.git

通过代理加速

git clone -b v0.3.3 https://ghp.ci/https://github.com/comfyanonymous/ComfyUI.git

(当然也可以用中的压缩包,只解压包中的ComfyUI文件夹即可) 

ComfyUI版本Python版本
v0.0.1--v0.0.33.11.8
v0.0.4--v0.2.33.11.9
v0.2.4--v0.3.63.12.7

注意:对于wheel模块,根据需要卸载或安装,可能需要反复进行卸载或安装,原因看第8点。

建议:安装编译环境。因为有些依赖项如果不下载whl安装,是需要编译安装的,编译环境安装可参考《在ComfyUI的python_embeded下编译安装module

附:ComfyUI 可实现的功能的示例(ComfyUI官方示例工作流)

2、使用 extra_model_paths.yaml 来引用模型

为了重装环境而不需要理会模型的放置,又或者需要安装多个不同版本的ComfyUI而共用模型,可以将模型放在固定位置,并通过文件extra_model_paths.yaml 来引用模型,但有些模型,是不能通过指引来引用的,必须放置到特定的目录下。附:《extra_model_paths.yaml解读》。

我的 ComfyUI\extra_model_paths.yaml 文件如下(根据自己的情况,只修改base_path即可):

#put this file in base_path like G:\ComfyUl windows portable\ComfyUl#  H: is SSD
a222:base_path: H:\SSD_models\checkpoints: checkpoints/vae: VAE/loras: |Loras
#         models/LyCORISclip: clip/clip_vision: clip_vision/controlnet: controlnet/instantid: instantidupscale_models: upscale_modelsdiffusion_models: diffusion_modelspulid: pulidBiRefNet: BiRefNetblip: blipLLM: LLMsams: samsunet: unet
#Only 1 path is allowed except for checkpoints, VAE, etcinpaint: inpaintstablesr: stablesrstyle_models: style_modelsa1111:base_path: G:\HD_models\checkpoints: checkpoints/vae: VAE/loras: |Loras
#         models/LyCORISclip: clip/clip_vision: clip_vision/controlnet: controlnet/instantid: instantidupscale_models: upscale_modelsdiffusion_models: diffusion_modelsunet: unetstyle_models: style_models

3、第一类节点:下载Zip包解压即可使用、或者再需要安装依赖项(requirements、[参考第5点安装所需]module,节点缺少的module与你的环境不同而会有差异,缺什么就装什么就是了

节点名称及下载地址

在路径ComfyUI\custom_nodes下

执行命令

备注

ComfyUI-Manager     Zip

在节点上显示节点 Id 

cg-use-everywhere     Zip

Comfyroll_CustomNodes    Zip

节点:

CR Text Concatenate  文本连接

CR Text  文本输入

ComfyUI_essentials     Zip

rgthree-comfy     Zip

Show fast toggles in Group Headers

在 Group Headers 中显示快速切换

点击查看B站关于该节点的使用教程

只有删除安装路径缓存temp文件,并退出

ComfyUI,才能彻底释放内存,

Image Comparer (rgthree) 才不会显示图像

Custom_Nodes_AlekPet

   ZIp

提示词翻译

AIGODLIKE-ComfyUI-Translation

Zip

语言包,至少从版本v0.3.10开始,已经不需要了。

comfyui-mixlab-nodes    Zip

..\..\python_embeded\python.exe -m pip install -r comfyui-mixlab-nodes\requirements.txt

提示词翻译

comfyui-inpaint-nodes     Zip

ComfyUI-Custom-Scripts      Zip

工具箱,🐍型图标,在设置中的pysssss项

设置 Image Feed Location 为hidden

不显示生成的图片在窗口4边

Comfyui_TTP_Toolset     Zip

NameError: name 'apply_gaussian_blur' is not defined点击连接有修复方法

ComfyUI_FaceAnalysis     Zip

需要安装如下module:

insightface、dlib

当protobuf<3.20.0时,只能用dlib

与ComfyUI-FluxTrainer对protobuf的要求可能冲突

把下载的模型解压到路径:

ComfyUI_FaceAnalysis\dlib

models\insightface\models\auraface\

models\insightface\models\buffalo_l\

节点:Face Bounding Box ,剪裁脸部(长方形),

可通过padding_percent=0.3《填充百分比》或padding来调整剪裁脸部大小

ComfyUI_InstantID     Zip

需要安装如下module:

insightface、onnxruntime-gpu、onnxruntime

把下载的模型解压到路径:

models\insightface\models\antelopev2\

ComfyUI_LayerStyle     Zip

..\..\python_embeded\python.exe -s -m pip install ComfyUI_LayerStyle\whl\docopt-0.6.2-py2.py3-none-any.whl

..\..\python_embeded\python.exe -s -m pip install ComfyUI_LayerStyle\whl\hydra_core-1.3.2-py3-none-any.whl

..\..\python_embeded\python.exe -s -m pip install -r ComfyUI_LayerStyle\requirements.txt

下面这个先不执行,看看运行情况再定:

ComfyUI_LayerStyle\repair_dependency.bat

模型只能放在该路径下ComfyUI\models\

节点所需模型:

LayerMask: PersonMaskUltra V2

models\mediapipe

LayerMask: SegmentAnythingUltra
models\sams
models\grounding-dino

模型70G

ComfyUI-BrushNet     Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-BrushNet\requirements.txt

会将 accelerate版本降到 0.31.0

ComfyUI-Crystools     ZIp

..\..\python_embeded\python.exe -m pip install -r ComfyUI-Crystools\requirements.txt

当ComfyUI中的参数Menu设置Top或bottom时,

参数Position要设为top才能显示

ComfyUI-KJNodes     Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-KJNodes\requirements.txt

comfyui-tensorops     Zip

..\..\python_embeded\python.exe -m pip install -r comfyui-tensorops\requirements.txt

ComfyUI-Florence2     Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-Florence2\requirements.txt

需要安装如下module:timm、accelerate

在DownloadAndLoadFlorence2Model选择flash_attention_2时,需要安装:flash_attn

模型只能放在该路径下ComfyUI\models\LLM

要将模型下载到不同的模型子目录下,

下载链接里面的所有文件都需要下载:

模型1:ComfyUI\models\LLM\Florence-2-large

模型2:ComfyUI\models\LLM\Florence-2-large-PromptGen-v1.5 

was-node-suite-comfyui     Zip

..\..\python_embeded\python.exe -m pip install -r was-node-suite-comfyui\requirements.txt

Image Crop Face 剪裁脸部(正方形)

不放大,不能处理批量图像

(下载所有文件)放到模型路径:

models\clipseg\models--CIDAS--clipseg-rd64-refined\snapshots

\583b388deb98a04feb3e1f816dcdb8f3062ee205

节点:

Text Concatenate  文本连接,可以去除前后空格

Text Multiline  文本输入

ComfyUI-Easy-Use     ZIp

..\..\python_embeded\python.exe -m pip install -r ComfyUI-Easy-Use\requirements.txt

If else 条件执行,点击参考B站使用视频

for 循环,点击参考B站使用视频

在节点上显示执行时间

ComfyUI-Inspyrenet-Rembg

Zip

抠图

..\..\python_embeded\python.exe -m pip install -r ComfyUI-Inspyrenet-Rembg\requirements.txt

packaging版本降到23.2

很奇怪,试过没放置模型时,很慢,放置模型\transparent-background后,很快,然后删除了模型,依然很快。

model_zoo.md

ComfyUI-GGUF     Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-GGUF\requirements.txt

ComfyUI-PuLID-Flux-Enhanced     Zip

需要安装如下module:facexlib、ftfy

模型放在(可引用)

models\pulid

20系列显卡因为不支持BF16,

用不了这个节点点击办法解决

ComfyUI-PuLID-Flux

Zip

原版(作者已经不提供支持,而且错误较多)

facerestore_cf     Zip

我修改了模型加载节点FaceRestoreModelLoade,

可以加载另外2个模型,实现

黑白变彩色、inpainting。

需要安装如下module:lpips

models/facerestore_models:GFPGANv1.4.pth 、 codeformer.pth、

codeformer_colorization.pth、

codeformer_inpainting.pth

models/facedetection:

detection_Resnet50_Final.pth detection_mobilenet0.25_Final.pth

yolov5l-face.pth 、yolov5n-face.pth

我最早接触的大名鼎鼎的脸部修复CodeFormer (被它的效果震撼到了)的comfyui实现节点

节点:CropFace ,剪裁脸部,并缩放到512*512

ComfyUI-SUPIR    Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-SUPIR\requirements.txt

Comfyui_CXH_joy_caption

     Zip    打标

需要安装如下module:

scikit_build_core、llama-cpp-python

..\..\python_embeded\python.exe -m pip install -r Comfyui_CXH_joy_caption\requirements.txt

模型:

clip/siglip-so400m-patch14-384

LLM/Meta-Llama-3.1-8B-bnb-4bit

models\Joy_caption_alpha

ComfyLiterals    Zip

ComfyUI-VideoHelperSuite    Zip

节点:

Load Images (Path) 装载路径下的所有图片

cg-training-tools    Zip

打标,节点:

Iterate Images、Save With Text File、Describe Image、Save Description

ComfyUI-FluxTrainer     Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-FluxTrainer\requirements.txt

需要安装如下module:protobuf版本要求<=3.20.0

可能与ComfyUI_FaceAnalysis

的要求冲突

ComfyUI-Inpaint-CropAndStitch

     Zip

示例工作流使用了ControlNetInpaintingAliMamaApply,对重绘区域先剪裁,重绘后再黏贴回原图

ComfyUI_IPAdapter_plus   Zip模型文件多,可查看参考文章。

comfyui-reactor-node

Zip

节点:

Save Face Model

Build Blended Face Model 参数:

send_only 设置为NO,则每次都重新构建

face_model name 可带路径保存构建的模型

Load Face Model 使用的路径:

models\reactor\faces

 模型路径及模型:

ComfyUI\models\insightface:

inswapper_128.onnx

ComfyUI\models\facerestore_models:

GPEN-BFR-512.onnx

models\ultralytics\bbox:

face_yolov8n.pt

models\sams:(可引用)

sam_vit_b_01ec64.pth

ComfyUI-

Bringing-Old-Photos-Back-to-Life

Zip

Load Face Detector Model (Dlib):

模型放置路径:models\facedetection

shape_predictor_68_face_landmarks.dat

其他模型:models\checkpoints、vae(可引用)

BOPBTL Models  、 Face Enhancement Models

comfyui_controlnet_aux

Zip

..\..\python_embeded\python.exe -m pip install -r comfyui_

controlnet_aux\requirements.txt

需要安装的模块 svglib ,要使用 wheel 编译

comfyui_face_parsing

Zip

模型:

  1. Download the .json and .safetensors files from the face parsing model repo and save them to the "models/face_parsing/" folder.
  2. Download the face_yolov8m.pt from the Bingsu/adetailer repo and save it to "models/ultralytics/bbox" folder.

masquerade-nodes-comfyui

Zip

ComfyUI-Detail-Daemon

Zip

ComfyUI_AdvancedRefluxControl

Zip

ComfyUI-Advanced-ControlNet

Zip

ComfyUI-Impact-Pack

Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-Impact-Pack\requirements.txt

模型放置路径:

models\sams

ComfyUI-Impact-Subpack

Zip

..\..\python_embeded\python.exe -m pip install -r ComfyUI-Impact-Subpack\requirements.txt

节点:UltralyticsDetectorProvider

从 ComfyUI-Impact-Pack 拆分出来

CharacterFaceSwap

Zip

节点:Crop Face  ,剪裁脸部(正方形),不放大,不能处理批量图像

节点:Load RetinaFace,

加载模型 detection_Resnet50_Final.pth

模型路径:ComfyUI\models\facexlib\

sd-lora-trainer

Zip

sd-ppp     Zip在 Photoshop 和 ComfyUI 之间进行通信


4、 第二类需要用 git 命令安装

加速参考《GitHub加速》,就是在地址前面加上https://ghp.ci/ ,例如:git clone https://ghp.ci/https://github.com/ltdrdata/ComfyUI-Impact-Pack --recursive

节点名称

在路径ComfyUI\custom_nodes下

执行命令

备注

ComfyUI_UltimateSDUpscalegit clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive
ComfyUI-Inspire-Packgit clone -v --recursive --progress -- https://github.com/ltdrdata/ComfyUI-Inspire-Pack

5、依赖 module 的安装

缺少什么模块就安装什么。

有些 module 还是比较大的,每次直接用 pip 安装,可能会下载比较长时间,将安装 whl 保存下来,下载安装时直接安装 whl ,将会节省你不少时间。要注意,有些模块是与环境版本匹配的,要下载匹配环境的。

模块名称及下载地址备注
insightface      whl

需要下载 whl 安装

numpy版本不能太高,需要安装较低版本:
python_embeded\python.exe -m pip install numpy===1.26.4

dlib      whl需要下载 whl 安装
onnxruntime-gpu      whl模块文件大小:279M
onnxruntime             whl文件较小,可以pip命令直接安装
facexlib      whl

依赖项 :filterpy

在python 3.11时无法自动Building wheel for filterpy ,从而无法安装

可以下载 filterpy  安装  ,或者使用 pip install facexlib --no-deps 不安装依赖项 filterpy。

模型放置路径:

\python_embeded\Lib\site-packages\facexlib\weights
所需模型:
detection_Resnet50_Final.pth  (PuLID-Flux需要)

parsing_bisenet.pth                   (PuLID-Flux需要)

parsing_parsenet.pth                 (PuLID-Flux需要)

alignment_WFLW_4HG.pth

recognition_arcface_ir_se50.pth

filterpy      whl需要下载 whl 安装,在python 3.12下可用pip直接安装
ftfy            whl
flash_attn    whl    whl下载 whl 安装,自行编译安装需要2-5个小时。
xformers       whl

模块文件大小:160M

没安装 xformers 时:Using pytorch cross attention

Using xformers cross attention

apex             whl

没安装 apex 时:

Nvidia APEX normalization not installed, using PyTorch LayerNorm

llama-cpp-python    whl需要下载 whl 安装,否则需要自己配置编译环境
wheel

 比较重要的module版本对应关系:

torchtorchaudiotorchvisionCUDA版本支持的torch版本
2.4.0 2.4.0 0.19.011.71.13.0--2.0.1
2.4.12.4.10.19.111.82.0.0--2.5.1
2.5.02.5.00.20.012.12.1.0--2.5.1
2.5.12.5.10.20.112.42.4.0--2.5.1

 6、批量去除文件夹名中字符-main、-master

上面第3点下载的Zip压缩包解压后,文件夹名称后面会带-main、-master,将下面命令复制到一个 bat 文件,放置到 ComfyUI\custom_nodes 路径下,双击运行即可批量 除文件夹名中字符-main、-master,例如文件夹 ComfyUI-KJNodes-main ,修改为 ComfyUI-KJNodes。

echo 批量去除文件夹名中字符-main、-master
@echo off
setlocal enabledelayedexpansionset "old_string=-main"
set "old_string_2=-master"for /d %%D in (*) do (set "folder_name=%%D"set "new_folder_name=!folder_name:%old_string%=!"set "new_folder_name_2=!folder_name:%old_string_2%=!"if "!folder_name!" neq "!new_folder_name!" (ren "%%D" "!new_folder_name!")if "!folder_name!" neq "!new_folder_name_2!" (ren "%%D" "!new_folder_name_2!"))@echo on

7、ComfyUI缓存路径

C:\Users\Monday\.cache 

H:\ComfyUI_windows_portable\ComfyUI\temp

8、python 3.11与python 3.12的一点区别引起的问题以及解决办法

①、在python 3.11环境中,想要安装 python.exe -m pip install filterpy包时,会报如下错误:

Collecting filterpy
  Using cached filterpy-1.4.5.zip (177 kB)
 
Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1

而在在python 3.12环境中,安装过程显示的信息如下:

Collecting filterpy
  Using cached filterpy-1.4.5.zip (177 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
 
Preparing metadata (pyproject.toml) ... done

发现 Preparing metadata 这个过程是不一样的,但在完全安装的 3.11环境中,安装filterpy包时是与 3.12 一样并能成功安装。花了一天时间各种尝试,终于从 get-pip.py 发现 3.11与3.12版本区别的地方,只要执行 python.exe -m pip uninstall wheel 卸载了 wheel 即可以。  

②、 而在安装comfyui_controlnet_aux的依赖项时,则出现了用 pyproject.toml 不能编译的错误:

Collecting svglib (from -r requirements.txt (line 15))
  Downloading svglib-1.5.1.tar.gz (913 kB)
     ---------------------------------------- 913.9/913.9 kB 2.6 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
 
Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.

 重新装回 wheel 后,依赖项安装成功。

 Collecting svglib (from -r requirements.txt (line 15))
  Using cached svglib-1.5.1.tar.gz (913 kB)
  Preparing metadata (setup.py) ... done

会不定时补充我自己安装过的节点资料。

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

相关文章:

  • 深度学习,训练集准确率高,但验证集准确率一直不上升,很低的问题
  • 【C语言程序设计——选择结构程序设计】求输入的日期是该年的第几天(头歌实践教学平台习题)【合集】
  • Lumos学习王佩丰Excel二十四讲系列完结
  • 前后端规约
  • 【数据可视化】数据可视化看板需求梳理模板(含示例)
  • CArray原理是什么,通过示例来展示如何使用?
  • 更换WordPress主题的基础知识及注意事项
  • springcloud篇3-docker需熟练掌握的知识点
  • 基于单片机的直流稳压电源的设计(论文+源码)
  • uniapp-vue3 实现, 一款带有丝滑动画效果的单选框组件,支持微信小程序、H5等多端
  • 解锁 C 语言字符函数密码,开启高效编程之路
  • LLM之RAG实战(五十一)| 使用python和Cypher解析PDF数据,并加载到Neo4j数据库
  • 力扣-数组-01两数之和
  • Flutter中的网络请求图片存储为缓存,与定制删除本地缓存
  • 保障移动应用安全:多层次安全策略应对新兴威胁
  • 【Linux】函数
  • Maven中管理SNAPSHOT版本含义及作用
  • win10 VS2019上libtorch库配置过程
  • 【计算机网络】课程 实验二 交换机基本配置和VLAN 间路由实现
  • Oracle Dataguard(主库为单节点)配置详解(4):将主库复制到备库并启动同步
  • OpenCL(贰):浅析CL内核程序接口函数
  • Leetcode 3407. Substring Matching Pattern
  • 学英语学压测:02jmeter组件-测试计划和线程组ramp-up参数的作用
  • Vue笔记-001-声明式渲染
  • 26考研资料分享 百度网盘
  • .NET 8 + Ocelot + Consul 实现代理网关、服务发现
  • 使用 Nginx 轻松处理跨域请求(CORS)
  • 【LeetCode Hot100 二分查找】搜索插入位置、搜索二维矩阵、搜索旋转排序数组、寻找两个正序数组的中位数
  • 使用MediaPipe Face Mesh 面部动作检测
  • 【Vue】<script setup>和 <script>区别是什么?在使用时的写法区别?