stable-diffusion-webui-forge icon indicating copy to clipboard operation
stable-diffusion-webui-forge copied to clipboard

FaceSwapLab support

Open DoctorDerp opened this issue 1 year ago • 10 comments

Checklist

  • [X] The issue exists after disabling all extensions
  • [X] The issue exists on a clean installation of webui
  • [X] The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • [X] The issue exists in the current version of the webui
  • [X] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

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

DoctorDerp avatar Feb 16 '24 01:02 DoctorDerp

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

LucianoDaluz avatar Feb 19 '24 14:02 LucianoDaluz

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.

thepwnshop avatar Feb 20 '24 20:02 thepwnshop

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

DrQuantumAI avatar Feb 20 '24 22:02 DrQuantumAI

yep,same here

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

Frankiesomeone avatar Feb 26 '24 00:02 Frankiesomeone

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.

skylerblack2 avatar Feb 28 '24 06:02 skylerblack2

Exact same issue

DDanDee avatar Mar 02 '24 09:03 DDanDee

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

AI-Ilikeit avatar Mar 02 '24 15:03 AI-Ilikeit

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

ncandelier avatar Mar 02 '24 20:03 ncandelier

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.

Laz777 avatar Mar 02 '24 23:03 Laz777

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!

DDanDee avatar Mar 02 '24 23:03 DDanDee