Gourieff / sd-webui-reactor

Fast and Simple Face Swap Extension for StableDiffusion WebUI (A1111 SD WebUI, SD WebUI Forge, SD.Next, Cagliostro)
GNU Affero General Public License v3.0
2.17k stars 235 forks source link

AttributeError: 'INSwapper' object has no attribute 'taskname' #369

Closed shaooping closed 2 months ago

shaooping commented 2 months ago

First, confirm

What happened?

19:14:50 - ReActor - STATUS - Working: source face index [0], target face index [0] 19:14:50 - ReActor - STATUS - Analyzing Source Image... *** Error running postprocess_image: D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_faceswap.py Traceback (most recent call last): File "D:\sd-webui-aki-v4.5\modules\scripts.py", line 774, in postprocess_image script.postprocess_image(p, pp, *script_args) File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_faceswap.py", line 443, in postprocess_image result, output, swapped = swap_face( File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 543, in swap_face source_faces = analyze_faces(source_img, det_thresh=detection_options.det_thresh, det_maxnum=detection_options.det_maxnum) File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 301, in analyze_faces face_analyser = copy.deepcopy(getAnalysisModel()) File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 145, in getAnalysisModel ANALYSIS_MODEL = insightface.app.FaceAnalysis( File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\console_log_patch.py", line 54, in patched_faceanalysis_init elif model.taskname not in self.models and (allowed_modules is None or model.taskname in allowed_modules): AttributeError: 'INSwapper' object has no attribute 'taskname'

Steps to reproduce the problem

Unable to perform face swap

I referenced this link but am still having problems with it at the moment: https://github.com/Gourieff/sd-webui-reactor/issues/149

Sysinfo

Os: Windows11pro Browser: MS Edge Gpu:Nvida 4070tisuper Sd-web-UI:sd-webui-aki-v4.5 Enabled plug-ins: 2024-02-26_193852

Relevant console log

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.7.0
Commit hash: cf2772fab0af5573da775e7437e6acdca424f26e
Installing sd-webui-controlnet requirement: handrefinerportable
CUDA 12.1
Launching Web UI with arguments: --theme dark --xformers --xformers-flash-attention --api --autolaunch
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 24.1.2, num models: 9
ControlNet preprocessor location: D:\sd-webui-aki-v4.5\extensions\sd-webui-controlnet\annotator\downloads
2024-02-26 19:12:28,528 - ControlNet - INFO - ControlNet v1.1.440
2024-02-26 19:12:28,615 - ControlNet - INFO - ControlNet v1.1.440
sd-webui-prompt-all-in-one background API service started successfully.
19:12:29 - ReActor - STATUS - Running v0.7.0-a2 on Device: CUDA
Loading weights [912c9dc74f] from D:\sd-webui-aki-v4.5\models\Stable-diffusion\realvisxlV40_v40Bakedvae.safetensors
2024-02-26 19:12:29,474 - AnimateDiff - INFO - Injecting LCM to UI.
2024-02-26 19:12:29,807 - AnimateDiff - INFO - Hacking i2i-batch.
2024-02-26 19:12:29,855 - ControlNet - INFO - ControlNet UI callback registered.
Running on local URL:  http://127.0.0.1:7860
Creating model from config: D:\sd-webui-aki-v4.5\repositories\generative-models\configs\inference\sd_xl_base.yaml

To create a public link, set `share=True` in `launch()`.
Startup time: 20.9s (prepare environment: 11.9s, import torch: 2.9s, import gradio: 0.8s, setup paths: 0.5s, initialize shared: 0.2s, other imports: 0.4s, load scripts: 1.8s, create ui: 0.9s, gradio launch: 0.9s, app_started_callback: 0.4s).
Applying attention optimization: xformers... done.
Model loaded in 7.9s (load weights from disk: 1.5s, create model: 0.9s, apply weights to model: 5.0s, apply half(): 0.1s, calculate empty prompt: 0.2s).
19:13:29 - ReActor - STATUS - Working: source face index [0], target face index [0]
19:13:29 - ReActor - STATUS - Analyzing Source Image...
*** Error running postprocess_image: D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_faceswap.py
    Traceback (most recent call last):
      File "D:\sd-webui-aki-v4.5\modules\scripts.py", line 774, in postprocess_image
        script.postprocess_image(p, pp, *script_args)
      File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_faceswap.py", line 443, in postprocess_image
        result, output, swapped = swap_face(
      File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 543, in swap_face
        source_faces = analyze_faces(source_img, det_thresh=detection_options.det_thresh, det_maxnum=detection_options.det_maxnum)
      File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 301, in analyze_faces
        face_analyser = copy.deepcopy(getAnalysisModel())
      File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 145, in getAnalysisModel
        ANALYSIS_MODEL = insightface.app.FaceAnalysis(
      File "D:\sd-webui-aki-v4.5\extensions\sd-webui-reactor\scripts\console_log_patch.py", line 54, in patched_faceanalysis_init
        elif model.taskname not in self.models and (allowed_modules is None or model.taskname in allowed_modules):
    AttributeError: 'INSwapper' object has no attribute 'taskname'

---

Additional information

No response

shaooping commented 2 months ago

onnx 1.15.0 onnxruntime 1.17.1 onnxruntime-gpu 1.17.1

Gourieff commented 2 months ago

There's smth wrong with your analysis models files, try to download them again https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/buffalo_l.zip and unzip them into the models/insightface/models/buffalo_l directory replacing existing ones You can also re-download the main model just in case and put it into models/insightface https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/inswapper_128.onnx