ComfyUI学习笔记(二):ComfyUI-Manager包使用

1.问题背景

ComfyUI使用起来非常方便,直接拿到一些别人搭好的工作流,然后导入并下载一下依赖的模型,最后点击运行,就可以看到结果。但是经常遇到的问题就是,你在导入工作流后,打开发现一堆红色节点,环境缺少对应依赖包,而这些红色节点对应包又十分难找,因此,就有了ComfyUI-Manager包,可以直接去扫描和安装缺失依赖包。

2.安装ComfyUI-Manager插件

1
2
3
4
5
6
# 1.进入自定义节点路径
>> cd \path\to\ComfyUI\custom_nodes
# 2.下载ComfyUI-Manager插件
>> git clone https://github.com/ltdrdata/ComfyUI-Manager.git
# 3.安装依赖
>> cd ComfyUI-Manager && pip install -r requirements.txt

3.启动ComfyUI服务

1
>> python main.py

4.ComfyUI界面安装缺失包

  • (1)查看命令参数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
>> python custom_nodes/ComfyUI-Manager/cm-cli.py --help

----------------------------------------------------------------------
[ComfyUI-Manager] NOTICE: Legacy backup exists
- Your old Manager data was backed up to:
/lv-data1/software/comfyui/user/__manager/.legacy-manager-backup
- Please verify and remove it when no longer needed.
----------------------------------------------------------------------


Usage: cm-cli.py [OPTIONS] COMMAND [ARGS]...

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
help Display help for commands │
│ install Install custom nodes │
│ reinstall Reinstall custom nodes │
│ uninstall Uninstall custom nodes │
│ update Update custom nodes │
disable Disable custom nodes │
enable Enable custom nodes │
│ fix Fix dependencies of custom nodes │
│ show-versions Show all available versions of the node │
│ show Show node list │
│ simple-show Show node list (simple mode) │
│ cli-only-mode Set whether to use ComfyUI-Manager in CLI-only mode. │
│ deps-in-workflow Generate dependencies file from workflow (.json/.png) │
│ save-snapshot Save a snapshot of the current ComfyUI environment. If output path isn't provided. Save to │
│ ComfyUI-Manager/snapshots path. │
│ restore-snapshot Restore snapshot from snapshot file │
│ restore-dependencies Restore dependencies from whole installed custom nodes. │
│ post-install Install dependencies and execute installation script │
│ install-deps Install dependencies from dependencies file(.json) or workflow(.png/.json) │
│ clear Clear reserved startup action in ComfyUI-Manager │
│ export-custom-node-ids Export custom node ids │
╰───────────────────────────────────────────────────────────
  • (2)打开ComfyUI界面:

ComfyUI_manager_ui

  • (3) 安装缺失包:

ComfyUI_manager_operation

 按道理,到这里就应该结束了,但是在生产环境会出现没法直接打开ui界面的情况,导致无法完成上述操作,此时只能使用命令行来完成操作。

5. ComfyUI-Manager命令行安装缺失包

  • (1)扫描工作流缺失包,生成依赖配置
1
>> cd \path\to\ComfyUI && python custom_nodes/ComfyUI-Manager/cm-cli.py deps-in-workflow --workflow /path/to/your/your_workflow.json --output ./workflow_deps.json
  • (2)根据生成依赖配置,安装缺失依赖
1
>> python custom_nodes/ComfyUI-Manager/cm-cli.py install-deps ./workflow_deps.json

参考资料