在ComfyUI中使用IPAdapater FaceID节点进行换脸 | AI绘画教程

安装insightface

检查Python版本

insightface是一个Python库,不管是运行reactor插件还是其他的换脸插件,都会用到这个Python库,由于ComfyUI是一个独立的虚拟环境,所以安装insightface库的方法有点特别

首先我们要查看下我们的comfyUI的虚拟环境中的Python版本

第一步:找到根目录下的“python_embeded”文件夹,进入到该文件夹中;

第二步:在该文件夹的路径栏输入“cmd”;

第三步:在弹出的cmd命令窗口中输入“python.exe -V”命令,此时我们就可以查看到我们ComfyUI中的Python版本,我的是“Python 3.11.6”版;

下载whl文件

我们在上面一步已经查看了我们自己的Python版本,接下来根据自己的Python版本下载相对应的whl文件:

3.10版:insightface-0.7.3-cp310-cp310-win_amd64.whl

3.11版:insightface-0.7.3-cp311-cp311-win_amd64.whl

将下载下来的whl文件放在“\ComfyUI_windows_portable\python_embeded”文件下面

在ComfyUI中使用IPAdapater FaceID节点进行换脸 | AI绘画教程

安装insightface

在之前打开的cmd命令窗口中先后运行如下的代码:

python -m pip install -U pip

在ComfyUI中使用IPAdapater FaceID节点进行换脸 | AI绘画教程

再运行下面的代码(根据你自己的Python版本和下载的whl文件修改whl的文件名):

python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl

或者

python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl

在ComfyUI中使用IPAdapater FaceID节点进行换脸 | AI绘画教程需要此工作流的可以从下面下载↓↓↓

资源下载此资源仅限注册用户下载,请先

原创文章,作者:朋远方,如若转载,请注明出处:https://caovan.com/aihuihuajiaochengzaicomfyuizhongshiyongipadapater-faceidjiedianjinxinghuanlian/.html

(15)
打赏 微信扫一扫 微信扫一扫
朋远方的头像朋远方
上一篇 2023年12月27日 下午8:02
下一篇 2024年1月6日 下午1:16

相关推荐

发表回复

登录后才能评论

评论列表(18条)

  • 1223的头像
    1223 2024年1月7日 下午5:31

    请问出现“Error occurred when executing IPAdapterApplyFaceID:

    CLIPVisionModelWithProjection.forward() got an unexpected keyword argument ‘intermediate_output’”

    • 朋远方的头像
      朋远方 2024年1月7日 下午5:33

      @1223应该是clip_vision的模型没有安装正确

    • 1223的头像
      1223 2024年1月7日 下午7:16

      @朋远方不行啊,我把原来的Clip_Vision的模型删除了重新下载了还是出同意的问题。

    • 1223的头像
      1223 2024年1月7日 下午7:35

      @朋远方找到原因了,IP适配模型不能用plus的,一用就出错。

    • 朋远方的头像
      朋远方 2024年1月7日 下午7:39

      @1223可以用plus的模型,但是你要lora模型也必须使用plus版本的,如果是plusV2版本的模型,你还需要将Apply IPAdapter FaceID节点中的faceid_v2 设置为TRUE

  • 啊啊啊no的头像
    啊啊啊no 2024年1月8日 下午6:34

    请教 InsightFaceLoader 报这个错是为什么呀
    Error occurred when executing InsightFaceLoader:

    No module named ‘onnx.onnx_cpp2py_export.defs’; ‘onnx.onnx_cpp2py_export’ is not a package

    File “D:\Blender_ComfyUI\ComfyUI\execution.py”, line 154, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
    File “D:\Blender_ComfyUI\ComfyUI\execution.py”, line 84, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
    File “D:\Blender_ComfyUI\ComfyUI\execution.py”, line 77, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
    File “D:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py”, line 529, in load_insight_face
    raise Exception(e)

  • 1173的头像
    1173 2024年1月9日 上午2:00

    Error occurred when executing KSampler:

    Query/Key/Value should either all have the same dtype, or (in the quantized case) Key/Value should have dtype torch.int32
    query.dtype: torch.float16
    key.dtype : torch.float32
    value.dtype: torch.float32

    Ksampler 报错

  • 小陶1999的头像
    小陶1999 2024年1月27日 下午5:32

    非常感谢您的教程,对新手很友好。

  • ldz3的头像
    ldz3 2024年2月2日 上午1:22

    大佬,这个问题怎么解决?
    Error occurred when executing InsightFaceLoader:

    No module named ‘sklearn’

    File “D:\App\Blender_ComfyUI\ComfyUI\execution.py”, line 155, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
    File “D:\App\Blender_ComfyUI\ComfyUI\execution.py”, line 85, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
    File “D:\App\Blender_ComfyUI\ComfyUI\execution.py”, line 78, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
    File “D:\App\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus-main\IPAdapterPlus.py”, line 537, in load_insight_face
    raise Exception(e)

    • 朋远方的头像
      朋远方 2024年2月2日 上午7:25

      @ldz3缺少“sklearn”这个Python库,你进到虚拟环境,pip install sklearn 一下这个库

  • 5350的头像
    5350 2024年2月8日 上午12:41

    想问下大佬,运行到InsightFace加载器的时候,出现这个报错是什么原因呀?

    Error occurred when executing InsightFaceLoader:

    module ‘onnxruntime’ has no attribute ‘InferenceSession’

    File “G:\ComfyUI\Blender_ComfyUI\ComfyUI\execution.py”, line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
    File “G:\ComfyUI\Blender_ComfyUI\ComfyUI\execution.py”, line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
    File “G:\ComfyUI\Blender_ComfyUI\ComfyUI\execution.py”, line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
    File “G:\ComfyUI\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py”, line 625, in load_insight_face
    from insightface.app import FaceAnalysis
    File “G:\ComfyUI\Blender_ComfyUI\python_embeded\lib\site-packages\insightface\__init__.py”, line 16, in
    from . import model_zoo
    File “G:\ComfyUI\Blender_ComfyUI\python_embeded\lib\site-packages\insightface\model_zoo\__init__.py”, line 1, in
    from .model_zoo import get_model
    File “G:\ComfyUI\Blender_ComfyUI\python_embeded\lib\site-packages\insightface\model_zoo\model_zoo.py”, line 22, in
    class PickableInferenceSession(onnxruntime.InferenceSession):

    • 朋远方的头像
      朋远方 2024年2月8日 上午8:20

      @5350应该是“insightface”安装有问题,你重新安装下insightface

  • 9100的头像
    9100 2024年2月12日 下午10:04

    我要疯了,搞了一整天,PC系统、comfy UI、全部重新装了个边。各种教程都尝试了,始终提示no modeul named “insightface.app”,到底是哪里出错了,大神可否告知?不胜感激!

    Error occurred when executing InsightFaceLoader:

    No module named ‘insightface.app’

    File “D:\comfyUIAI\ComfyUI\execution.py”, line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “D:\comfyUIAI\ComfyUI\execution.py”, line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “D:\comfyUIAI\ComfyUI\execution.py”, line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “D:\comfyUIAI\comfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py”, line 627, in load_insight_face
    raise Exception(e)

    • 9100的头像
      9100 2024年2月12日 下午11:09

      @9100终于搞明白了,原来就是insightface文件夹下缺少models,网上找到faceID的models拷贝进去,终于跳过去了!啊~~!我的一天两夜,全耗在这个问题上了!!!笑哭

  • 7190的头像
    7190 2024年2月27日 下午1:38

    Expected query, key, and value to have the same dtype, but got query.dtype: struct c10::Half key.dtype: float and value.dtype: float instead.
    这个是什么错误啊,求大神解决

  • lzqg的头像
    lzqg 2024年3月31日 下午1:22

    请问博主这个问题如何解决,谢谢!!!

    When loading the graph, the following node types were not found:
    加载图形时,未找到以下节点类型:
    InsightFace加载器
    IPAdapter应用(FaceID) IPAdapter应用(FaceID)