Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Includes 30 custom nodes committed directly, 7 Civitai-exclusive loras stored via Git LFS, and a setup script that installs all dependencies and downloads HuggingFace-hosted models on vast.ai. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8.8 KiB
8.8 KiB
- 解决插件 ComfyUI-PuLID-Flux 存在的模型污染问题。
- 🆕 支持商业友好的FaceNet实现 - 作为InsightFace的替代方案,用于商业用途,无许可证限制。
- 支持使用TeaCache加速(
TeaCache加速需要配合ComfyUI_Patches_ll使用)。 - 支持使用Comfy-WaveSpeed加速, Comfy-WaveSpeed在提交记录-36ba3c8中提供支持。
- 支持使用简单的
First Block Cache加速(可以配合ComfyUI_Patches_ll使用)。
在安装此插件之前,必须卸载或禁用ComfyUI-PuLID-Flux和其他PuLID Flux节点, 因为由于某些原因,我使用了同样的节点名ApplyPulidFlux
ComfyUI主体版本需要>=0.3.7
🏢 商业用途支持
该插件现已支持基于FaceNet的人脸分析作为InsightFace的替代方案,使其适用于商业应用:
- 无ArcFace许可证限制 - FaceNet可自由用于商业用途
- 兼容API - 可直接替换InsightFace工作流
- 生产就绪 - 可靠的人脸检测和嵌入生成
只需在工作流中使用PulidFluxFaceNetLoader替代PulidFluxInsightFaceLoader即可。
更新日志
2025.02.19
- 解决多张人脸时选择的人脸嵌入量和对齐特征不是同一个人脸的问题。
2025.02.18
- 支持从含有多张脸的图片中选择一张脸作为参考。示例工作流.
2025.01.27
- 修改 facexlib 的模型路径为
ComfyUI/models/facexlib/. - 自动下载时 修改 Antelopev2 模型的路径为
ComfyUI/models/insightface/models/antelopev2/. - 修改 EVA_CLIP_L_14_336 的模型路径为
ComfyUI/models/clip/.
预览 (图片含工作流)
安装
- 手动
cd custom_nodes
git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll.git
cd ComfyUI_PuLID_Flux_ll
pip install -r requirements.txt
# 重启 ComfyUI
安装问题:
- 如果使用
ComfyUI_windows_portable并遇到以下错误, 请查看 https://github.com/deepinsight/insightface/issues/2576
insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp(36): fatal error C1083: 无法打开包括文件: "Python.h": No such file or directory
error: command 'd:\\installed\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for insightface
Failed to build insightface
模型
可用的 Flux 模型
- 32bit/16bit (~22GB VRAM): model, encoder
- 8bit gguf (~12GB VRAM): model, encoder
- 8 bit FP8 e5m2 (~12GB VRAM): model, encoder
- 8 bit FP8 e4m3fn (~12GB VRAM): model, encoder
- Clip and VAE (for all models): clip, vae
若使用 GGUF 需要安装 ComfyUI-GGUF
PuLID 模型
- 下载 PuLID-Flux 到目录
ComfyUI/models/pulid/ - (支持自动下载)下载 EVA02-CLIP-L-14-336 到目录
ComfyUI/models/clip/
人脸分析模型
用于商业用途(推荐):
- FaceNet - 无需额外下载!使用带有预训练VGGFace2模型的
facenet-pytorch- ✅ 商业许可证友好
- ✅ 无需外部模型下载
- ✅ 自动模型加载
- 配合
PulidFluxFaceNetLoader节点使用
用于非商业/研究用途:
- (支持自动下载)从 AntelopeV2 下载所有
*.onnx模型文件到目录ComfyUI/models/insightface/models/antelopev2/. - (支持自动下载)下载 parsing_bisenet, parsing_parsenet and Resnet50 到目录
ComfyUI/models/facexlib/.- 配合
PulidFluxInsightFaceLoader节点使用
- 配合
节点
- PulidFluxModelLoader
- PulidFluxFaceNetLoader 🆕
- 基于FaceNet的商业友好人脸分析
- 无需额外模型下载
- 兼容所有PuLID工作流
- 支持CPU和CUDA执行
- PulidFluxInsightFaceLoader
- 传统的基于InsightFace的分析
- PulidFluxEvaClipLoader
- ApplyPulidFlux
- 解决了原插件中模型污染的问题
- 同时支持FaceNet和InsightFace - 无缝兼容
attn_mask可能不能正确工作, 因为我不知道如何实现它, 尝试了多种方式效果都未能达到预期,可以正常工作了。- 使用 TeaCache加速, 必须加在
FluxForwardOverriderandApplyTeaCachePatch之前. - 使用 Comfy-WaveSpeed加速, 必须加在
ApplyFBCacheOnModel之前.
- FixPulidFluxPatch (已弃用)
- 如果想使用 TeaCache加速, 必须加在
ApplyPulidFlux节点之后, 并在后面连接节点FluxForwardOverriderandApplyTeaCachePatch.
- 如果想使用 TeaCache加速, 必须加在
- PulidFluxOptions
input_faces_order- 对检测到的脸部边界框的排序规则。left-right: 按列从左到右对bbox的左边界进行排序。right-left:left-right的倒序(按列从右到左对bbox的左边界进行排序)。top-bottom: 按行从上到下对bbox的顶部边界进行排序。bottom-top:top-bottom的倒序(按行从下到上对bbox的顶部边界进行排序)。small-large: 按bbox的面积从小到大排序。large-small: 按bbox的面积从大到小排序。
input_faces_index- 从排序后的bbox选取的索引号。input_faces_align_mode- 选择对齐脸部特征的检测方式。0: 旧版本方式,一张图片中有张脸时选择的脸部嵌入量和对齐特征可能不一致。1: 保持选择的脸部嵌入量和对齐特征一致。- 两种出图有细微差别,值
1的align_face结果图比0的embed_face范围小一点。
- PulidFluxFaceDetector
- 用来检查在
ApplyPulidFlux实际使用的面部特征。 - 同时支持FaceNet和InsightFace后端
input_faces_align_mode = 0时,embed_face和align_face理论上应该是同一张脸,但它们由不同的检测器产生,可能检测到的数量不一致,因此两张图可能不是同一张脸。input_faces_align_mode = 1时,embed_face和align_face由相同的检测器产生,两张图始终是同一张脸。face_bbox_image- 画出检测到的脸部边界框(embed_face的检测器结果)。
- 用来检查在
使用示例
商业工作流 (FaceNet)
PulidFluxFaceNetLoader -> ApplyPulidFlux
研究工作流 (InsightFace)
PulidFluxInsightFaceLoader -> ApplyPulidFlux
两种工作流产生兼容的结果,可以互换使用。
感谢
facenet-pytorch - 用于商业友好的人脸识别


