About | Installation guide | Custom nodes | Workflows | Workflow script | Tips | Changelog
Implementation of faceswap based on InstantID for ComfyUI. \ Allows usage of LCM Lora which can produce good results in only a few generation steps. Works ONLY with SDXL checkpoints.
About | Installation guide | Custom nodes | Workflows | Workflow script | Tips | Changelog
pip install -r requirements.txt
to install dependenciesManually download required files and create required folders:
antelopev2 models and put them into ComfyUI/models/insightface/models/antelopev2 folder
LCM Lora *Optional (but higly recomended)
Newly added files hierarchy should look like this:
ComfyUI
\---models
\---ipadapter
ipadapter.bin
\---controlnet
\---ControlNetModel
config.json
diffusion_pytorch_model.safetensors
\---insightface
\---models
\antelopev2
1k3d68.onnx
2d106det.onnx
genderage.onnx
glintr100.onnx
scrfd_10g_bnkps.onnx
*Note You don't need to add the 'ipadapter', 'controlnet', and 'lora' folders to this specific location if you already have them somewhere else.
Instead, You can edit ComfyUI/extra_model_paths.yaml
and add folders containing those files to the config.
About | Installation guide | Custom nodes | Workflows | Workflow script | Tips | Changelog
params:
Loads everything and sets up the pipeline \ params:
Prepares face embeds for the generation, you can chain face embeds to improve results \ params:
Generates new face from input Image based on input mask \ params:
guidance_scale
> 1.don't
.guidance_scale
> 1About | Installation guide | Custom nodes | Workflows | Workflow script | Tips | Changelog
You can find example workflows in the /workflows folder.
About | Installation guide | Custom nodes | Workflows | Workflow script | Tips | Changelog
The simple script, workflow_generate.py
, can generate workflows based on the face images contained in a specific folder. The script will automatically generate appropriate nodes and connect them together. Keep in mind that there is no validation to check if there is a face in the image.
You can copy the workflow_generate.py
script anywhere you want for easier access; it has no dependencies inside the custom_node.
Only files with extensions: jpg, jpeg, bmp, png, gif, webp, and jiff will be included in the workflow.
The script will not upload reference images into the ComfyUI/input
folder. As a result, you won't be able to preview those images.
If you move, rename, delete image files, or modify paths in any way, the workflow will stop working.
You may see warnings (errors) in the console while loading generated workflows, ignore those.
arguments:
This command will generate 'albert.json' workflow, which should include all the required nodes for face reference images in the 'C:\Users\Admin\Desktop\ALBERT' folder.
workflow_generate.py C:\Users\Admin\Desktop\ALBERT albert
About | Installation guide | Custom nodes | Workflows | Workflow script | Tips | Changelog
No face detected in pose image
error try to increase padding. It means the current mask + padding is not enough to detect the face in the input image by insightface.About | Installation guide | Custom nodes | Workflows | Workflow script | Tips | Changelog
mask_strength
parameter has been fixed; it now functions correctly. Previously, it was stuck at 0.9999 regardless of the chosen value.ip_adapter_scale
parameter has been fixed. If you were using the xformers, this parameter could be stuck at 50.rotate_face
parameter. It will attempt to rotate the image to keep the face straight before processing and rotate it back to the original position afterward.--fp16-vae
argument to disable the default VAE upcasting to float32.resize
and resize_to
options into just resize
for the Faceswap generate node. To emulate the old behavior where resize was unchecked, select don't
.mask_strength
to range from 0.00 to 1.00.pip install -r requirements.txt
or
pip install -U diffusers~=0.26.0