目录
前言
ComfyUI,作为当前SD的一个节点流版本,非常适合高级AI设计师使用;InstantID,作为换脸的SOTA技术,以高度拟合,达到以假乱真的地步而流行;ArtGallery,非常人性化的将提示词,以可视化的方式展示出来,从而广受欢迎。
这里,我们尝试将这三种组合放在一起使用,能达到什么惊奇的效果呢?
一、ComfyUI
以节点流的方式,来运行扩散模型的过程,非常适合多个任务的并行运行,也适合使用模板来运行。这样的好处,即可适合新手使用,又不限制高手制作作品。
这是使用一个模板来制作作品的节点流过程,如下:
1.1 安装过程
直接网上搜秋叶ComfyUI,我们使用的版本是aki-1.4,基本是同期最新的版本。(但是,最新的版本,不一定最好用,伴随着不少bug,本篇博客,就是为了解决这些bug而生的)
1.2 我们使用的大模型
base model:SDXL1.0-base
ControlNet: control_instant_id_sdxl (去HG下载即可)
IP-adapter: ip-adapter-instantid-sdxl
二、InstantID
1.换脸模型
换脸模型有faceID,当InstantID应该是目前最能打的模型。其效果如下:
因为人脸肖像权,我们仅放一些虚拟的人物照片。
2.2 安装
InstantID安装,直接在extension里面可以下载,我们下载的版本是ZHO-ZHO-ZHO的版本,因为可以跟他的ArtGallery共生共用。
需要搭个梯子才能下载;
这一步,问题也不大;
三、ArtGallery
3.1.ArtGallery介绍
这个仓库(节点)也是一个可视化提示词的工具。其效果如下:
里面包含很多背景的图片,可以作为设计的元素。
3.2 ArtGallery BUG
报错详细
huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on
问题说明
在使用到huggingface时,下载连接不稳定导致,ConnectError。
解决方式
使用镜像网站链接解决稳定性问题,可使用以下其中一种方式改变huggingface网址
2)使用命令行修改环境变量并运行代码
#Linux
export HF_ENDPOINT=“https://hf-mirror.com”
python xxx.py
#Windows Powershell
$env:HF_ENDPOINT = “https://hf-mirror.com”
然后找到源码对应位置 应该是这里
1)在python代码中加入以下代码
例如运行的代码为main.py,就在main.py代码里最上面添加
import os
os.environ[“HF_ENDPOINT”] = “https://hf-mirror.com”
Bug 2
raise TypeError(“For single controlnet: controlnet_conditioning_scale
must be type float
.”)
TypeError: For single controlnet: controlnet_conditioning_scale
must be type float
.
修改文件如下:
修改代码前后的对比
代码如下(示例):
#原始的代码
# 1. Check inputs. Raise error if not correct
self.check_inputs(
prompt,
prompt_2,
image,
callback_steps,
negative_prompt,
negative_prompt_2,
prompt_embeds,
negative_prompt_embeds,
pooled_prompt_embeds,
negative_pooled_prompt_embeds,
controlnet_conditioning_scale,
control_guidance_start,
control_guidance_end,
callback_on_step_end_tensor_inputs,
)
#修改后的代码
self.check_inputs(
prompt,
prompt_2,
image,
callback_steps,
negative_prompt,
negative_prompt_2,
prompt_embeds,
negative_prompt_embeds,
pooled_prompt_embeds,
negative_pooled_prompt_embeds,
controlnet_conditioning_scale = controlnet_conditioning_scale,
control_guidance_start = control_guidance_start,
control_guidance_end = control_guidance_end,
callback_on_step_end_tensor_inputs = callback_on_step_end_tensor_inputs,
)
至此,就把人搞得郁闷两天的代码和工程,终于调通了!!!皆大欢喜,更多的作品,我们将会逐渐展示!
总结
AIGC,就像一个魔方棒一样,能够让人的视界得到拓展;如何玩起来,做有意思的作品,动起来吧!