A1111 WebUI / WebUI-Forge | SD.Next | Google Colab SD WebUI
If you use AUTOMATIC1111 SD WebUI or SD WebUI Forge:
https://github.com/Gourieff/sd-webui-reactor
in the "Install from URL" tab - and click "Install"automatic\venv\Scripts
or (MacOS/Linux)automatic/venv/bin
, run Terminal or Console (cmd) for that folder and type activate
pip install insightface==0.7.3
https://github.com/Gourieff/sd-webui-reactor
in the "Install from URL" tab and click "Install"automatic\extensions\sd-webui-reactor
directory - if you see there models\insightface
folder with the file inswapper_128.onnx
, just move the file to the automatic\models\insightface
folderIf you use Cagliostro Colab UI:
https://github.com/Gourieff/sd-webui-reactor
in the "Install from URL" tab - and click "Install"Using this software you are agree with disclaimer
ReActor detects faces in images in the following order:
left->right, top->bottom
And if you need to specify faces, you can set indexes for source and input images.
Index of the first detected face is 0.
You can set indexes in the order you need.
E.g.: 0,1,2 (for Source); 1,0,2 (for Input).
This means: the second Input face (index = 1) will be swapped by the first Source face (index = 0) and so on.
You can specify the gender to detect in images.
ReActor will swap a face only if it meets the given condition.
Use the "Restore Face" option. You can also try the "Upscaler" option or for more finer control, use an upscaler from the "Extras" tab. You can also set the postproduction order (from 0.1.0 version):
The old logic was the opposite (Upscale -> then Restore), resulting in worse face quality (and big texture differences) after upscaling.
Select the face numbers you wish to swap using the "Comma separated face number(s)" option for swap-source and result images. You can use different index order.
This means NSFW filter detected that your image is NSFW.
You can choose to activate the swap on the source image or on the generated image, or on both using the checkboxes. Activating on source image allows you to start from a given base and apply the diffusion process to it.
ReActor works with Inpainting - but only the masked part will be swapped.
Please use with the "Only masked" option for "Inpaint area" if you enabled "Upscaler". Otherwise use the upscale option via the Extras tab or via the Script loader (below the screen) with "SD upscale" or "Ultimate SD upscale".
From the version 0.5.0 you can use ReActor via the Extras Tab. It gives a superfast perfomance and ability to swap face2image avoiding SD pipeline that can cause smushing of original image's details
You can use ReActor with the built-in Webui API or via an external API.
Please follow this page for the detailed instruction.
Please, check the path where "inswapper_128.onnx" model is stored. It must be inside the folder stable-diffusion-webui\models\insightface
. Move the model there if it's stored in a different directory.
(for Mac M1/M2 users) If you get errors when trying to install Insightface - please read https://github.com/Gourieff/sd-webui-reactor/issues/42
(for Windows Users) If you have VS C++ Build Tools or MS VS 2022 installed but still have a problem, then try the next step:
(for Any OS Users) If the problem still there, then do the following:
venv\Lib\site-packages
folder or (MacOS/Linux)venv/lib/python3.10/site-packages
~
(e.g. "~rotobuf") - delete themvenv\Scripts
or (MacOS/Linux)venv/bin
activate
pip install -U pip
pip install insightface==0.7.3
pip install onnx
pip install "onnxruntime-gpu>=1.16.1"
pip install opencv-python
pip install tqdm
deactivate
, you can close your Terminal or Console and start your SD WebUI, ReActor should start OK - if not, welcome to the Issues section.First of all - you need to disable any other Roop-based extensions:
Alternative solutions:
Probably, you need to disable the "SD-CN-Animation" extension (or perhaps some another that causes the conflict)
This error may occur if there's smth wrong with the model file inswapper_128.onnx
Try to download it manually from here
and put it to the stable-diffusion-webui\models\insightface
replacing existing one
venv\Lib\site-packages
or (MacOS/Linux)venv/lib/python3.10/site-packages
and see if there are any folders with names start from "~" (for example "~rotobuf"), delete themvenv\Scripts
or (MacOS/Linux)venv/bin
run Terminal or Console (cmd) there and type activate
python -m pip install -U pip
pip uninstall -y onnxruntime onnxruntime-gpu onnxruntime-silicon onnxruntime-extensions
pip install "onnxruntime-gpu>=1.16.1"
If it didn't help - it seems that you have another extension reinstalling onnxruntime
when SD WebUI checks requirements. Please see your extensions list. Some extensions can causes reinstalling of onnxruntime-gpu
to onnxruntime<1.16.1
every time SD WebUI runs.
ORT 1.16.0 has a bug https://github.com/microsoft/onnxruntime/issues/17631 - don't install it!
venv\Lib\site-packages
or (MacOS/Linux)venv/lib/python3.10/site-packages
and see if there are any folders with names start from "~" (for example "~rotobuf"), delete themvenv\Scripts
or (MacOS/Linux)venv/bin
run Terminal or Console (cmd) there and type activate
python -m pip install -U pip
pip uninstall protobuf
pip install "protobuf>=3.20.3"
If this method doesn't help - there is some other extension that has a wrong version of protobuf dependence and SD WebUI installs it on a startup requirements check
.\venv\Scripts\activate
python -m pip install -U pip
system\python\python.exe -m pip install -U pip
pip install insightface-0.7.3-cp310-cp310-win_amd64.whl
system\python\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl
If after git pull
you see the message: Merge made by the 'recursive' strategy
and then when you check git status
you see Your branch is ahead of 'origin/main' by
Please do the next:
Inside the folder extensions\sd-webui-reactor
run Terminal or Console (cmd) and then:
git reset f48bdf1 --hard
git pull
OR
Just delete the folder sd-webui-reactor
inside the extensions
directory and then run Terminal or Console (cmd) and type git clone https://github.com/Gourieff/sd-webui-reactor
If you encounter any issues with installing this extension in the StabilityMatrix package manager - read here how to solve: https://github.com/Gourieff/sd-webui-reactor/issues/129#issuecomment-1768210875
A good and quick way to check for Extensions updates: https://github.com/Gourieff/sd-webui-extensions-updater
You can use ReActor with ComfyUI.
For the installation instruction follow the ReActor Node repo
This software is meant to be a productive contribution to the rapidly growing AI-generated media industry. It will help artists with tasks such as animating a custom character or using the character as a model for clothing etc.
The developers of this software are aware of its possible unethical application and are committed to take preventative measures against them. We will continue to develop this project in the positive direction while adhering to law and ethics.
Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers and Contributors of this software are not responsible for actions of end-users.
By using this extension you are agree not to create any content that:
This software utilizes the pre-trained models buffalo_l
and inswapper_128.onnx
, which are provided by InsightFace. These models are included under the following conditions:
From insighface licence: The InsightFace’s pre-trained models are available for non-commercial research purposes only. This includes both auto-downloading models and manually downloaded models.
Users of this software must strictly adhere to these conditions of use. The developers and maintainers of this software are not responsible for any misuse of InsightFace’s pre-trained models.
Please note that if you intend to use this software for any commercial purposes, you will need to train your own models or find models that can be used commercially.
inswapper_128.onnx
MD5:a3a155b90354160350efd66fed6b3d80
SHA256:e4a3f08c753cb72d04e10aa0f7dbe3deebbf39567d4ead6dce08e98aa49e16af
1k3d68.onnx
MD5:6fb94fcdb0055e3638bf9158e6a108f4
SHA256:df5c06b8a0c12e422b2ed8947b8869faa4105387f199c477af038aa01f9a45cc
2d106det.onnx
MD5:a3613ef9eb3662b4ef88eb90db1fcf26
SHA256:f001b856447c413801ef5c42091ed0cd516fcd21f2d6b79635b1e733a7109dbf
det_10g.onnx
MD5:4c10eef5c9e168357a16fdd580fa8371
SHA256:5838f7fe053675b1c7a08b633df49e7af5495cee0493c7dcf6697200b85b5b91
genderage.onnx
MD5:81c77ba87ab38163b0dec6b26f8e2af2
SHA256:4fde69b1c810857b88c64a335084f1c3fe8f01246c9a191b48c7bb756d6652fb
w600k_r50.onnx
MD5:80248d427976241cbd1343889ed132b3
SHA256:4c06341c33c2ca1f86781dab0e829f88ad5b64be9fba56e56bc9ebdefc619e43
Please check hashsums if you download these models from unverified (or untrusted) sources