# sd-webui-reactor **Repository Path**: sd-web/sd-webui-reactor ## Basic Information - **Project Name**: sd-webui-reactor - **Description**: No description available - **Primary Language**: Unknown - **License**: AGPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-03-12 - **Last Updated**: 2024-03-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

## What's new in the latest updates
To use "Face Model" axis - you should enable ReActor and choose any face model as the Source:
Full size demo image: [xyz_demo_2.png](https://raw.githubusercontent.com/Gourieff/Assets/main/sd-webui-reactor/xyz_demo_2.png)
### 0.7.0 BETA1
- X/Y/Z Script support (up to 3 axes: CodeFormer Weight, Restorer Visibility, Face Mask Correction)
Full size demo image: [xyz_demo.png](https://raw.githubusercontent.com/Gourieff/Assets/main/sd-webui-reactor/xyz_demo.png)
__Don't forget to enable ReActor and set any source (to prevent "no source" error)__
### 0.7.0 ALPHA1
- You can now blend faces to build blended face models ("Tools->Face Models->Blend") - due to popular demand

- CUDA 12 Support in the Installer script for 1.17.0 ORT-GPU library
- New tab "Detection" with "Threshold" and "Max Faces" parameters
### 0.6.1 BETA3
- 'Force Upscale' option inside the 'Upscale' tab: ReActor will run the Upscaler even if there's no face is detected (FR https://github.com/Gourieff/sd-webui-reactor/issues/116)
- ReActor shows filenames of source images in-process when the multiple images mode or the folder mode (random as well) is selected
### 0.6.1 BETA2
- 'Save original' option works fine now when you select 'Multiple Images' or 'Source Folder'
- Random Mode for 'Source Folder'
### 0.6.0
- New Logo
- Adaptation to A1111 1.7.0 (appropriate GFPGAN loader)
- New URL for the main model file
- UI reworked
- You can now load several source images (with reference faces) or set the path to the folder containing faces images
### 0.5.1
- You can save face models as "safetensors" files (stored in `
### Face Indexes
ReActor detects faces in images in the following order:
*The old logic was the opposite (Upscale -> then Restore), resulting in worse face quality (and big texture differences) after upscaling.*
### There are multiple faces in result
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.
### ~~The result is totally black~~
~~This means NSFW filter detected that your image is NSFW.~~
### Img2Img
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.
## API
You can use ReActor with the built-in Webui API or via an external API.
Please follow **[this](/API.md)** page for the detailed instruction.
## Troubleshooting
### **I. "You should at least have one model in models directory"**
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.
### **II. Any problems with installing Insightface or other dependencies**
(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:
1. Close (stop) your SD WebUI Server and start it again
(for Any OS Users) If the problem still there, then do the following:
1. Close (stop) your SD WebUI Server if it's running
2. Go to (Windows)`venv\Lib\site-packages` folder or (MacOS/Linux)`venv/lib/python3.10/site-packages`
3. If you see any folders with names start from `~` (e.g. "~rotobuf") - delete them
4. Go to (Windows)`venv\Scripts` or (MacOS/Linux)`venv/bin`
5. Run Terminal or Console (cmd) for that folder and type `activate`
6. Update your pip at first: `pip install -U pip`
7. Then one-by-one:
- `pip install insightface==0.7.3`
- `pip install onnx`
- `pip install "onnxruntime-gpu>=1.16.1"`
- `pip install opencv-python`
- `pip install tqdm`
8. Type `deactivate`, you can close your Terminal or Console and start your SD WebUI, ReActor should start OK - if not, welcome to the Issues section.
### **III. "TypeError: UpscaleOptions.init() got an unexpected keyword argument 'do_restore_first'"**
First of all - you need to disable any other Roop-based extensions:
- Go to 'Extensions -> Installed' tab and uncheck any Roop-based extensions except this one
- Click 'Apply and restart UI'
Alternative solutions:
- https://github.com/Gourieff/sd-webui-reactor/issues/3#issuecomment-1615919243
- https://github.com/Gourieff/sd-webui-reactor/issues/39#issuecomment-1666559134 (can be actual, if you use Vladmandic SD.Next)
### **IV. "AttributeError: 'FaceSwapScript' object has no attribute 'enable'"**
Probably, you need to disable the "SD-CN-Animation" extension (or perhaps some another that causes the conflict)
### **V. "INVALID_PROTOBUF : Load model from <...>\models\insightface\inswapper_128.onnx failed:Protobuf parsing failed" OR "AttributeError: 'NoneType' object has no attribute 'get'" OR "AttributeError: 'FaceSwapScript' object has no attribute 'save_original'"**
This error may occur if there's smth wrong with the model file `inswapper_128.onnx`
Try to download it manually from [here](https://huggingface.co/datasets/Gourieff/ReActor/resolve/main/models/inswapper_128.onnx)
and put it to the `stable-diffusion-webui\models\insightface` replacing existing one
### **VI. "ValueError: This ORT build has ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'] enabled" OR "ValueError: This ORT build has ['AzureExecutionProvider', 'CPUExecutionProvider'] enabled"**
1. Close (stop) your SD WebUI Server if it's running
2. Go to the (Windows)`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 them
3. Go to the (Windows)`venv\Scripts` or (MacOS/Linux)`venv/bin` run Terminal or Console (cmd) there and type `activate`
4. Then:
- `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.