lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
7.8k stars 747 forks source link

FaceSwapLab support #274

Open DoctorDerp opened 7 months ago

DoctorDerp commented 7 months ago

Checklist

What happened?

I have installed a brand new forge webui from scratch to verify this issue. Basically the extension does not work in the image2image tab specifically. It works in the text2image tab though. This issue is not present in the regular Automatic1111.

Steps to reproduce the problem

Download faceswaplab extension and attempt to replace a face in the image2image tab.

What should have happened?

Face is replaced with another face.

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

Windows 11, RTX4090, Brand new forge ui installed from scratch with one click installer.

Console logs

100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00,  5.43it/s]
2024-02-15 20:12:42,667 - FaceSwapLab - INFO - Try to use model : G:\Forge\webui_forge_cu121_torch21\webui\models\faceswaplab\inswapper_128.onnx
2024-02-15 20:12:42,750 - FaceSwapLab - INFO - Load analysis model det_size=(320, 320), det_thresh=0.5, providers = ['CUDAExecutionProvider'], will take some time. (> 30s)
Loading (320, 320) analysis model (first time is slow):   0%|                                 | 0/1 [00:00<?, ?model/s]2024-02-15 20:12:42.8415985 [E:onnxruntime:Default, provider_bridge_ort.cc:1546 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "G:\Forge\webui_forge_cu121_torch21\system\python\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

2024-02-15 20:12:43.3760108 [E:onnxruntime:Default, provider_bridge_ort.cc:1546 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "G:\Forge\webui_forge_cu121_torch21\system\python\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

2024-02-15 20:12:43.4768121 [E:onnxruntime:Default, provider_bridge_ort.cc:1546 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "G:\Forge\webui_forge_cu121_torch21\system\python\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

2024-02-15 20:12:43.6837614 [E:onnxruntime:Default, provider_bridge_ort.cc:1546 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "G:\Forge\webui_forge_cu121_torch21\system\python\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

2024-02-15 20:12:43.8062580 [E:onnxruntime:Default, provider_bridge_ort.cc:1546 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "G:\Forge\webui_forge_cu121_torch21\system\python\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

Loading (320, 320) analysis model (first time is slow): 100%|█████████████████████████| 1/1 [00:01<00:00,  1.56s/model]
2024-02-15 20:12:44,314 - FaceSwapLab - INFO - ("Applied providers: ['CPUExecutionProvider'], with options: "
 "{'CPUExecutionProvider': {}}\n"
 'find model: '
 'G:\\Forge\\webui_forge_cu121_torch21\\webui\\models\\faceswaplab\\analysers\\models\\buffalo_l\\1k3d68.onnx '
 "landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0\n"
 "Applied providers: ['CPUExecutionProvider'], with options: "
 "{'CPUExecutionProvider': {}}\n"
 'find model: '
 'G:\\Forge\\webui_forge_cu121_torch21\\webui\\models\\faceswaplab\\analysers\\models\\buffalo_l\\2d106det.onnx '
 "landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0\n"
 "Applied providers: ['CPUExecutionProvider'], with options: "
 "{'CPUExecutionProvider': {}}\n"
 'find model: '
 'G:\\Forge\\webui_forge_cu121_torch21\\webui\\models\\faceswaplab\\analysers\\models\\buffalo_l\\det_10g.onnx '
 "detection [1, 3, '?', '?'] 127.5 128.0\n"
 "Applied providers: ['CPUExecutionProvider'], with options: "
 "{'CPUExecutionProvider': {}}\n"
 'find model: '
 'G:\\Forge\\webui_forge_cu121_torch21\\webui\\models\\faceswaplab\\analysers\\models\\buffalo_l\\genderage.onnx '
 "genderage ['None', 3, 96, 96] 0.0 1.0\n"
 "Applied providers: ['CPUExecutionProvider'], with options: "
 "{'CPUExecutionProvider': {}}\n"
 'find model: '
 'G:\\Forge\\webui_forge_cu121_torch21\\webui\\models\\faceswaplab\\analysers\\models\\buffalo_l\\w600k_r50.onnx '
 "recognition ['None', 3, 112, 112] 127.5 127.5\n"
 'set det-size: (320, 320)\n')
2024-02-15 20:12:44,334 - FaceSwapLab - INFO - blend all faces together
2024-02-15 20:12:44,334 - FaceSwapLab - INFO - loading face Dima_at_10.safetensors
2024-02-15 20:12:44,335 - FaceSwapLab - INFO - Int Gender : 0
2024-02-15 20:12:44,335 - FaceSwapLab - INFO - Process face 0
2024-02-15 20:12:44,341 - FaceSwapLab - INFO - Source Gender 0
2024-02-15 20:12:44,342 - FaceSwapLab - INFO - Target faces count : 0
2024-02-15 20:12:44,345 - FaceSwapLab - INFO - Finished processing image, return 1 images
2024-02-15 20:12:44,346 - FaceSwapLab - INFO - 1 images swapped
2024-02-15 20:12:44,346 - FaceSwapLab - ERROR - Failed to swap face in postprocess method : apply_overlay() takes 3 positional arguments but 4 were given
Traceback (most recent call last):
  File "G:\Forge\webui_forge_cu121_torch21\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 201, in postprocess
    swp_img = imgutils.apply_mask(swp_img, p, batch_index)
  File "G:\Forge\webui_forge_cu121_torch21\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_utils\imgutils.py", line 224, in apply_mask
    img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images)
TypeError: apply_overlay() takes 3 positional arguments but 4 were given
Total progress: 100%|████████████████████████████████████████████████████████████████████| 3/3 [00:02<00:00,  1.23it/s]
100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00,  5.25it/s]
2024-02-15 20:13:58,381 - FaceSwapLab - INFO - Try to use model : G:\Forge\webui_forge_cu121_torch21\webui\models\faceswaplab\inswapper_128.onnx
2024-02-15 20:13:58,479 - FaceSwapLab - INFO - blend all faces together
2024-02-15 20:13:58,479 - FaceSwapLab - INFO - loading face Dima_at_38.safetensors
2024-02-15 20:13:58,485 - FaceSwapLab - INFO - Int Gender : 1
2024-02-15 20:13:58,485 - FaceSwapLab - INFO - Process face 0
2024-02-15 20:13:58,491 - FaceSwapLab - INFO - Source Gender 1
2024-02-15 20:13:58,491 - FaceSwapLab - INFO - Target faces count : 0
2024-02-15 20:13:58,495 - FaceSwapLab - INFO - Finished processing image, return 1 images
2024-02-15 20:13:58,495 - FaceSwapLab - INFO - 1 images swapped
2024-02-15 20:13:58,495 - FaceSwapLab - ERROR - Failed to swap face in postprocess method : apply_overlay() takes 3 positional arguments but 4 were given
Traceback (most recent call last):
  File "G:\Forge\webui_forge_cu121_torch21\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 201, in postprocess
    swp_img = imgutils.apply_mask(swp_img, p, batch_index)
  File "G:\Forge\webui_forge_cu121_torch21\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_utils\imgutils.py", line 224, in apply_mask
    img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images)
TypeError: apply_overlay() takes 3 positional arguments but 4 were given
Total progress: 100%|████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00,  3.36it/s]
Total progress: 100%|████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 10.41it/s]

Additional information

No response

LucianoDaluz commented 7 months ago

How did you installed? Couldnt even make its tab appears.

thepwnshop commented 7 months ago

I have the identical issue. Haven't changed anything that I'm aware of, and just manifested today. Was working fine a few days ago.

Worth noting: Works fine in txt2img, error occurs for me in img2img.

DrQuantumAI commented 7 months ago

I have the same exact issue: it works in t2i but not in i2i.

Frankiesomeone commented 7 months ago

yep,same here

FaceSwapLab - ERROR - Failed to swap face in postprocess method : apply_overlay() takes 3 positional arguments but 4 were given

skylerblack2 commented 7 months ago

i have the same issue. it works on txt2img but not img2img.

in txt2img i also see a warning in the console logs that looks like this:

...\AppData\Roaming\Python\Python310\site-packages\insightface\utils\transform.py:68: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions. To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1. P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4

I'm not sure whether that's having any impact on performance though. Using Windows 11.

DDanDee commented 7 months ago

Exact same issue

AI-Ilikeit commented 7 months ago

I am not able to confirm, but i think i got this to work in I2I by switching/reversing the check marks for swap source in, etc...

edit: yes, the face does swap for me when "Swap in source image (blended face)" is checked and the next one is unchecked

ncandelier commented 7 months ago

Same issue here after an automatic update, working also when "Swap in source image (blended face)" is checked and the next one is unchecked

Laz777 commented 7 months ago

I am not able to confirm, but i think i got this to work in I2I by switching/reversing the check marks for swap source in, etc...

edit: yes, the face does swap for me when "Swap in source image (blended face)" is checked and the next one is unchecked

Mine does not seem to work in I2I at all. I've tried checking/unchecking the boxes you mentioned, using checkpoints and directly inputting reference images. If I have "Swap in generated image" checked I get the error listed above. If I have the option for source image checked, the face isn't swapped at all. Text to image works fine, however.

EDIT: I initially updated from A1111 v1.6 to 1.8 when I started getting the error. I have since downgraded to 1.7 and things work fine again.

DDanDee commented 7 months ago

I am not able to confirm, but i think i got this to work in I2I by switching/reversing the check marks for swap source in, etc...

edit: yes, the face does swap for me when "Swap in source image (blended face)" is checked and the next one is unchecked

Yes, that works!