Skip to content

Commit

Permalink
improve doc, fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
glucauze committed Aug 5, 2023
1 parent 0db1f45 commit db79243
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
12 changes: 11 additions & 1 deletion docs/documentation.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ You need a sufficiently recent version of your SD environment. Using the GPU has

In Version 1.2.1, the ability to use the GPU has been added, a setting that can be configured in SD at startup. Currently, this feature is only supported on Windows and Linux, as the necessary dependencies for Mac have not been included.

The `--faceswaplab_gpu` option in SD can be added to the args in webui-user.sh or webui-user.bat.
The `--faceswaplab_gpu` option in SD can be added to the args in webui-user.sh or webui-user.bat. **There is also an option in SD settings**.

The model stays loaded in VRAM and won't be unloaded after each use. As of now, I don't know a straightforward way to handle this, so it will occupy space continuously. If your system's VRAM is limited, enabling this option might not be advisable.

Expand All @@ -196,6 +196,16 @@ You should therefore be able to debug a little before activating the option. If

The first time the swap is used, the program will continue to use the CPU, but will offer to install the GPU. You will then need to restart. This is due to the optimizations made by SD.Next to the installation scripts.

For SD.Next, the best is to install dependencies manually :

on windows :

```shell
.\venv\Scripts\activate
cd .\extensions\sd-webui-faceswaplab\
pip install .\requirements-gpu.txt
```

## Settings

You can change the program's default behavior in your webui's global settings (FaceSwapLab section in settings). This is particularly useful if you want to have default options for inpainting or for post-processsing, for example.
Expand Down
21 changes: 13 additions & 8 deletions scripts/faceswaplab_swapping/swapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ def use_gpu() -> bool:
@lru_cache
def force_install_gpu_providers() -> None:
# Ugly Ugly hack due to SDNEXT :
from scripts.configure import check_install

logger.warning("Try to reinstall gpu dependencies")
check_install()
logger.warning("IF onnxruntime-gpu has been installed successfully, RESTART")
logger.warning(
"On SD.NEXT/vladmantic you will also need to check numpy>=1.24.2 and tensorflow>=2.13.0"
)
try:
from scripts.configure import check_install

logger.warning("Try to reinstall gpu dependencies")
check_install()
logger.warning("IF onnxruntime-gpu has been installed successfully, RESTART")
logger.warning(
"On SD.NEXT/vladmantic you will also need to check numpy>=1.24.2 and tensorflow>=2.13.0"
)
except:
logger.error(
"Reinstall has failed (which is normal on windows), please install requirements-gpu.txt manually to enable gpu."
)


def get_providers() -> List[str]:
Expand Down

0 comments on commit db79243

Please sign in to comment.