佛系程序员
首页
栏目
标签
归档
关于
友链
佛系程序员
首页
栏目
标签
归档
友链
关于
Comfyui工作流搭建实战(人物换脸)
学习笔记
网站开发
发布日期: 2025-05-29 19:39:03
喜欢量: 7 个
阅读次数:
19
生成人物艺术照写真 工作流搭建
先下载项目代码地址:https://github.com/comfyanonymous/ComfyUI 再在本地运行起来。 # 生成人物艺术照写真 ## 1:文生图工作流 添加节点: CheckPoint加载器,CLIP文本编码器,K采样器,空Latent, VAE编码,预览图像,  这张图片需要的提示词: . 正向提示词:anime girl,anime girl,AOJI,AOJI,anime girl,Aesthetics art,Head illustration,features,face close-up,extreme light and shadow,backlight,pink long hair,sky blue highlights,girls,45° looking at the sky,blue solid background,brush painting,brush texture,virtual focus,granular,hazy,retro,old,minimalism,anime girl, 负向提示词: NSFW,(worst quality:2),(low quality:2),(normal quality:2), lowres, nomal quality, ((monochrome)),((grqyscale)),skin spots, acnes, skin blemishes, age spot, (ugly:1.331),(duplicate:1.331),(morbid:1.21),(extra legs:1.331),(fused fingers:1.5),(too many fingers:1.5),(unclear eys:1.331),lowers, bad hands, missing fingers, extra digit, bad hands, missing fingers,(((extra arms and legs))), 你可以换个正向提示词:A young anime girl with long flowing gold hair and subtle sky blue highlights, standing beside a loyal dog, both gazing forward in harmony with a gentle 10° upward tilt toward the distant horizon. The lush background features a majestic European-style castle nestled among rolling green hills, ancient towering trees, and a serene ocean under a warm twilight sky. Rendered in a Studio Ghibli-inspired anime style with soft watercolor textures, delicate hand-painted details, and gentle cel-shading. The scene glows with golden hour backlighting, casting ethereal sun flares and soft shadows. A sense of wonder and quiet adventure permeates the composition, evoking nostalgia and harmony with nature. 16:9 cinematic aspect ratio, with a dreamy, slightly grainy film-like quality ## 2:上传一张人物艺术照片,生成同样脸部特征的图片。 此过程:提取人物脸部特征。 环境和项目介绍: 电脑 NIVIDIA GeForce RTX 3080,12G,win10, 可同时运行,SD,ComfyUI, 大模型 文件共用。 wwwroot/stable-diffusion-webui wwwroot/ComfyUI comfyUI 安装后, 问题1: 需要instantID节点,却找不到? 解决:需安装instant ID, 问题2:如何安装自定义插件? 解决:ComfyUI-Manager安装, 在 https://github.com/Comfy-Org/ComfyUI-Manager、 安装完成后,在页面,右上角能看到Manager按钮。 问题3:如何安装instant ID? 解决:进入,Custom nodes manager, Search找到 instant ID, 官方模块 ComfyUI_InstantID,安装。 问题4:安装过程中,中间报错,缺少insightface模块? 解决:用Anconda Prompt, 打开命令行,进入: conda acitvate sdwebui pip install insightface 问题5:又得到提示,缺少C++? 解决:https://visualstudio.microsoft.com/visual-cpp-build-tools/ 然后安装了C++ 问题6:pydantic 版本不对? 解决:并将 pydantic 版本降级到 fastapi 所要求的范围。 InstantID安装成功后。 问题7:如何添加 InstantID? 解决:在comfyui文生图的工作流中,添加 Apply InstantID, 连接 Load InstantID Model, 具体来说,共四个: 应用instantID,ControlNet加速器,InstantID面部分析,InstantID模型加载器, 问题8:Load InstantID Model ,instantid_file 没有显示文件,里面没有模型? 解决:因为所有的模型,我放在:E:\yiyi\wwwroot\ComfyUI\models\controlnet 比如:ip_adapter_instant_id_sdxl.bin,ip-adapter-full-face_sd15.safetensors,ip-adapter_sd15.bin ... 在排错过程中,发现antelopev2多了一层目录 : E:\yiyi\wwwroot\ComfyUI\models\insightface\models\antelopev2\antelopev2 这里手动去除,多余一层目录 。 并且,软链接: mklink "%COMFY%\instantid\ip_adapter_instant_id_sdxl.bin" "%SDW_EXT%\ip_adapter_instant_id_sdxl.bin" mklink "%COMFY%\instantid\ip-adapter-plus-face_sdxl_vit-h.safetensors" "%SDW_EXT%\ip-adapter-plus-face_sdxl_vit-h.safetensors" mklink "%COMFY%\instantid\ip-adapter-plus-face_sd15.safetensors" "%SDW_EXT%\ip-adapter-plus-face_sd15.safetensors" mklink "%COMFY%\instantid\ip-adapter-full-face_sd15.safetensors" "%SDW_EXT%\ip-adapter-full-face_sd15.safetensors" 问题9:控制台报错了,未能正常加载 CUDA, 解决:由于 stable-diffusion-webui\venv 环境中,有 onnxruntimes 但是conda activate sdwebui 没有。 系统环境变量 PATH 中添加了 venv 的 capi 路径 E:\yiyi\wwwroot\stable-diffusion-webui\venv\Lib\site-packages\onnxruntime\capi\ 这样:onnxruntime-gpu 就能正常加载 CUDA DLL 测试 onnxruntime 能否用 CUDA: conda activate sdwebui python >>> import onnxruntime as ort >>> ort.get_available_providers() ['CUDAExecutionProvider', 'CPUExecutionProvider'] 添加 venv 的 DLL 路径到系统 PATH ✅ 所有环境都能用这些 DLL Conda 中运行 SDWebUI/ComfyUI ✅ 会自动找到 DLL 并启用 CUDA 需要重启终端 ✅ 是的,旧终端不会继承新 PATH 注:❗❗ CUDA Toolkit 并不是通过 pip 安装的,所以你在 pip list 中 看不到 CUDA Toolkit 12.2 是否安装。 报错10:生成了图片,图片不对,是三排牙齿,控制台报错: [Prompt Server] web root: E:\yiyi\ProgramData\anaconda3\envs\sdwebui\lib\site-packages\comfyui_frontend_package\static Unable to parse pyproject.toml due to lack dependency pydantic-settings, please run 'pip install -r requirements.txt': No module named 'pydantic_settings' 解决办法:安装pydantic_settings 每次安装完,关闭窗口,重启comfyui 此过程成功后,是这样的效果:  ## 3:上传一张艺术照模板图和一张某女生人脸图片,生成某女生的艺术照 内容会尽量补充,请稍等些时间,
文章作者:
yyii
文章链接:
http://amtb.info/show/MjE3
版权声明:
本博客所有文章除特別声明外,转载请注明来源
佛系程序员
!
分享:
搜索