Bing-su / adetailer

Auto detecting, masking and inpainting with detection model.
GNU Affero General Public License v3.0
4.08k stars 316 forks source link

[Bug]: ValidationError when validating 4th arguments, ValidationError: 2 validation errors for ADetailerArgs, none is not an allowed value (type=type_error.none.not_allowed) #677

Open edusachs opened 1 month ago

edusachs commented 1 month ago

Describe the bug

When using the "/sdapi/v1/txt2img" endpoint (API) of the stable-diffusion-webui-forge with ADetailer, I am encountering execution errors.

I am using the onnxruntime_gpu-1.17.0.dist-info; this was the only modification I made due to a new bug in Reactor.

The image is generated by Automatic1111, but without the modifications from ADetailer.

I have also attached the error images in this bug report.

The payload used is shown below.

Payload:

{ "prompt": "amateur cellphone photography portrait photography of a woman in the office, wearing a black jacket, wearing a blue jeans, blonde hair, blue eyes, Nikon Z9 . f8.0, samsung galaxy, noise, jpeg artefacts, poor lighting, low light, underexposed, high contrast, , hand, , , perfect hands", "negative_prompt": "ugly, deformed, noisy, blurry, low contrast, dark, cluttered, messy, unattractive, gloomy, distorted, watermark, logo, logotype, brand", "seed": -1, "sampler_name": "DPM++ 2M SDE", "scheduler": "Karras", "steps": 60, "cfg_scale": 7.0, "width": 832, "height": 1216, "restore_faces": false, "vae": "sdxl_vae.safetensors", "clip_skip": 1, "alwayson_scripts": { "ADetailer": { "args": [ { "ad_model": "hand_yolov8n.pt", "ad_confidence": 0.3, "ad_dilate_erode": 4, "ad_mask_blur": 4, "ad_denoising_strength": 0.4, "ad_inpaint_only_masked": true } ] }, "reactor": { "args": [ "", true, "0", "0", "I:\\stable-diffusion-webui\\models\\insightface\\inswapper_128.onnx", "CodeFormer", 1, true, "4x_NMKD-Superscale-SP_178000_G", 1.5, 1, false, true, 1, 0, 0, false, 1.0, true, false, "CUDA", true, 1, "face-model-01.safetensors", "I:\\StockMillionare\\01-generate-prompts\\faces-temp", null, false, false, 0.5, 0 ] } } }

Steps to reproduce

1 - Install the stable-diffusion-webui-forge version f1.0.2v1.10.1-previous-52-gaf0b04cc. 3 - Install the adetailer and reactor. 4 - Change the current version of onnxruntime_gpu to this one: onnxruntime_gpu-1.17.0.dist-info 2 - Use the /sdapi/v1/txt2img endpoint with the described payload.

Screenshots

Here is the sequence of images of the execution with the error (issue).

Erro-01 Erro-02 Erro-03 Erro-04 Erro-05 Erro-06

Console logs, from start to end.

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f1.0.2v1.10.1-previous-52-gaf0b04cc
Commit hash: af0b04cc16ce703b2f6b7a06edbb5f301a804a94
Launching Web UI with arguments: --embeddings-dir 'I:\Fooocus-Models\embeddings' --ckpt-dir 'I:\Fooocus-Models\checkpoints' --lora-dir 'I:\Fooocus-Models\loras' --pin-shared-memory --cuda-malloc --cuda-stream --api --skip-install
Using cudaMallocAsync backend.
Total VRAM 16376 MB, total RAM 65359 MB
Set vram state to: NORMAL_VRAM
Always pin shared GPU memory
Device: cuda:0 NVIDIA GeForce RTX 4080 SUPER : cudaMallocAsync
VAE dtype: torch.bfloat16
CUDA Stream Activated:  True
Using pytorch cross attention
Using pytorch cross attention
ControlNet preprocessor location: I:\stable-diffusion-webui-forge\webui\models\ControlNetPreprocessor
[-] ADetailer initialized. version: 24.8.0, num models: 13
15:46:07 - ReActor - STATUS - Running v0.7.1-a1 on Device: CUDA
Loading weights [2d5af23726] from I:\Fooocus-Models\checkpoints\realismEngineSDXL_v30VAE.safetensors
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
model_type EPS
UNet ADM Dimension 2816
2024-08-05 15:46:12,277 - ControlNet - INFO - ControlNet UI callback registered.
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
extra {'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids', 'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_l.text_projection'}
Loading VAE weights specified in settings: I:\stable-diffusion-webui-forge\webui\models\VAE\sdxl_vae.safetensors
To load target model SDXLClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  15022.451263427734
[Memory Management] Model Memory (MB) =  2144.3546981811523
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  11854.096565246582
Moving model(s) has taken 1.03 seconds
Model loaded in 11.3s (load weights from disk: 0.3s, forge instantiate config: 1.9s, forge load real models: 7.0s, forge finalize: 0.1s, load VAE: 0.3s, calculate empty prompt: 1.7s).
IIB Database file has been successfully backed up to the backup folder.
Startup time: 30.0s (prepare environment: 2.8s, launcher: 2.6s, import torch: 4.3s, setup paths: 0.9s, initialize shared: 0.3s, other imports: 0.8s, load scripts: 5.5s, create ui: 6.0s, gradio launch: 2.9s, add APIs: 3.6s).
[-] ADetailer: ValidationError when validating 2nd arguments
*** Error running process: I:\stable-diffusion-webui-forge\webui\extensions\adetailer\scripts\!adetailer.py
    Traceback (most recent call last):
      File "I:\stable-diffusion-webui-forge\webui\modules\scripts.py", line 844, in process
        script.process(p, *script_args)
      File "I:\stable-diffusion-webui-forge\webui\extensions\adetailer\aaaaaa\traceback.py", line 173, in wrapper
        raise error from None
    RuntimeError:
    ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │                                                                                                              System info                                                                                                              │
    │ ┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃             ┃ Value                                                                                                                                                                                                               ┃ │
    │ ┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │
    │ │    Platform │ Windows-10-10.0.19045-SP0                                                                                                                                                                                           │ │
    │ │      Python │ 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]                                                                                                                                    │ │
    │ │     Version │ f1.0.2v1.10.1-previous-52-gaf0b04cc                                                                                                                                                                                 │ │
    │ │      Commit │ af0b04cc16ce703b2f6b7a06edbb5f301a804a94                                                                                                                                                                            │ │
    │ │ Commandline │ ['launch.py', '--embeddings-dir', 'I:\\Fooocus-Models\\embeddings', '--ckpt-dir', 'I:\\Fooocus-Models\\checkpoints', '--lora-dir', 'I:\\Fooocus-Models\\loras', '--pin-shared-memory', '--cuda-malloc',             │ │
    │ │             │ '--cuda-stream', '--api', '--skip-install']                                                                                                                                                                         │ │
    │ │   Libraries │ {'torch': '2.1.2+cu121', 'torchvision': '0.16.2+cu121', 'ultralytics': '8.2.71', 'mediapipe': '0.10.14'}                                                                                                            │ │
    │ └─────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
    │                                                                                                                Inputs                                                                                                                 │
    │ ┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃                 ┃ Value                                                                                                                                                                                                           ┃ │
    │ ┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │
    │ │          prompt │ amateur cellphone photography portrait photography of a woman in the office, wearing a black jacket, wearing a blue jeans, blonde hair, blue eyes, Nikon Z9 . f8.0, samsung galaxy, noise, jpeg artefacts, poor │ │
    │ │                 │ lighting, low light, underexposed, high contrast, <lora:detailed_hands:1.0>, hand, <lora:HandFineTuning_XL:1>, <lora:Perfect Hands:1>, perfect hands                                                            │ │
    │ │ negative_prompt │ ugly, deformed, noisy, blurry, low contrast, dark, cluttered, messy, unattractive, gloomy, distorted, watermark, logo, logotype, brand                                                                          │ │
    │ │          n_iter │ 1                                                                                                                                                                                                               │ │
    │ │      batch_size │ 1                                                                                                                                                                                                               │ │
    │ │           width │ 832                                                                                                                                                                                                             │ │
    │ │          height │ 1216                                                                                                                                                                                                            │ │
    │ │    sampler_name │ DPM++ 2M SDE                                                                                                                                                                                                    │ │
    │ │       enable_hr │ False                                                                                                                                                                                                           │ │
    │ │     hr_upscaler │ None                                                                                                                                                                                                            │ │
    │ │      checkpoint │ realismEngineSDXL_v30VAE.safetensors [2d5af23726]                                                                                                                                                               │ │
    │ │             vae │ sdxl_vae.safetensors                                                                                                                                                                                            │ │
    │ │            unet │ Automatic                                                                                                                                                                                                       │ │
    │ └─────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
    │                 ADetailer                                                                                                                                                                                                             │
    │ ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓                                                                                                                                                                                             │
    │ ┃                     ┃ Value           ┃                                                                                                                                                                                             │
    │ ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩                                                                                                                                                                                             │
    │ │             version │ 24.8.0          │                                                                                                                                                                                             │
    │ │            ad_model │ hand_yolov8n.pt │                                                                                                                                                                                             │
    │ │           ad_prompt │                 │                                                                                                                                                                                             │
    │ │  ad_negative_prompt │                 │                                                                                                                                                                                             │
    │ │ ad_controlnet_model │ None            │                                                                                                                                                                                             │
    │ │              is_api │ True            │                                                                                                                                                                                             │
    │ └─────────────────────┴─────────────────┘                                                                                                                                                                                             │
    │ ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\webui\extensions\adetailer\aaaaaa\traceback.py:153 in wrapper    │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │   152 │   │   try:                                                                               │                                                                                                                                  │
    │ │ ❱ 153 │   │   │   return func(*args, **kwargs)                                                   │                                                                                                                                  │
    │ │   154 │   │   except Exception as e:                                                             │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\webui\extensions\adetailer\scripts\!adetailer.py:693 in process  │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │    692 │   │                                                                                     │                                                                                                                                  │
    │ │ ❱  693 │   │   arg_list = self.get_args(p, *args_)                                               │                                                                                                                                  │
    │ │    694                                                                                           │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\webui\extensions\adetailer\scripts\!adetailer.py:246 in get_args │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │    245 │   │   │   try:                                                                          │                                                                                                                                  │
    │ │ ❱  246 │   │   │   │   inp = ADetailerArgs(**arg_dict)                                           │                                                                                                                                  │
    │ │    247 │   │   │   except ValueError as e:                                                       │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\system\python\lib\site-packages\pydantic\v1\main.py:341 in       │                                                                                                                                  │
    │ │ __init__                                                                                         │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │    340 │   │   if validation_error:                                                              │                                                                                                                                  │
    │ │ ❱  341 │   │   │   raise validation_error                                                        │                                                                                                                                  │
    │ │    342 │   │   try:                                                                              │                                                                                                                                  │
    │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                                                                                  │
    │ ValidationError: 2 validation errors for ADetailerArgs                                                                                                                                                                                │
    │ ad_prompt                                                                                                                                                                                                                             │
    │   none is not an allowed value (type=type_error.none.not_allowed)                                                                                                                                                                     │
    │ ad_negative_prompt                                                                                                                                                                                                                    │
    │   none is not an allowed value (type=type_error.none.not_allowed)                                                                                                                                                                     │
    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

---
[LORA] Loaded I:\Fooocus-Models\loras\detailed_hands-000002.safetensors for SDXL-UNet with 722 keys at weight 1.0 (skipped 0 keys)
[LORA] Loaded I:\Fooocus-Models\loras\detailed_hands-000002.safetensors for SDXL-CLIP with 264 keys at weight 1.0 (skipped 0 keys)
[LORA] Loaded I:\Fooocus-Models\loras\HandFineTuning_XL.safetensors for SDXL-UNet with 722 keys at weight 1.0 (skipped 0 keys)
[LORA] Loaded I:\Fooocus-Models\loras\HandFineTuning_XL.safetensors for SDXL-CLIP with 264 keys at weight 1.0 (skipped 0 keys)
[LORA] Loaded I:\Fooocus-Models\loras\Perfect Hands v2.safetensors for SDXL-UNet with 722 keys at weight 1.0 (skipped 0 keys)
[LORA] Loaded I:\Fooocus-Models\loras\Perfect Hands v2.safetensors for SDXL-CLIP with 264 keys at weight 1.0 (skipped 0 keys)
To load target model SDXLClipModel
Begin to load 1 model
Reuse 1 loaded models
[Memory Management] Current Free GPU Memory (MB) =  13205.260301589966
[Memory Management] Model Memory (MB) =  0.0
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  12181.260301589966
Moving model(s) has taken 1.14 seconds
To load target model SDXL
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  13187.661832809448
[Memory Management] Model Memory (MB) =  4897.086494445801
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  7266.5753383636475
Moving model(s) has taken 1.95 seconds
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 60/60 [00:11<00:00,  5.20it/s]
To load target model IntegratedAutoencoderKL████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 60/60 [00:11<00:00,  5.40it/s]
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  8260.997213363647
[Memory Management] Model Memory (MB) =  159.55708122253418
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  7077.440132141113
Moving model(s) has taken 0.06 seconds
[-] ADetailer: ValidationError when validating 2nd arguments
*** Error running postprocess_image: I:\stable-diffusion-webui-forge\webui\extensions\adetailer\scripts\!adetailer.py
    Traceback (most recent call last):
      File "I:\stable-diffusion-webui-forge\webui\modules\scripts.py", line 940, in postprocess_image
        script.postprocess_image(p, pp, *script_args)
      File "I:\stable-diffusion-webui-forge\webui\extensions\adetailer\aaaaaa\traceback.py", line 173, in wrapper
        raise error from None
    RuntimeError:
    ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │                                                                                                              System info                                                                                                              │
    │ ┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃             ┃ Value                                                                                                                                                                                                               ┃ │
    │ ┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │
    │ │    Platform │ Windows-10-10.0.19045-SP0                                                                                                                                                                                           │ │
    │ │      Python │ 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]                                                                                                                                    │ │
    │ │     Version │ f1.0.2v1.10.1-previous-52-gaf0b04cc                                                                                                                                                                                 │ │
    │ │      Commit │ af0b04cc16ce703b2f6b7a06edbb5f301a804a94                                                                                                                                                                            │ │
    │ │ Commandline │ ['launch.py', '--embeddings-dir', 'I:\\Fooocus-Models\\embeddings', '--ckpt-dir', 'I:\\Fooocus-Models\\checkpoints', '--lora-dir', 'I:\\Fooocus-Models\\loras', '--pin-shared-memory', '--cuda-malloc',             │ │
    │ │             │ '--cuda-stream', '--api', '--skip-install']                                                                                                                                                                         │ │
    │ │   Libraries │ {'torch': '2.1.2+cu121', 'torchvision': '0.16.2+cu121', 'ultralytics': '8.2.71', 'mediapipe': '0.10.14'}                                                                                                            │ │
    │ └─────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
    │                                                                                                                Inputs                                                                                                                 │
    │ ┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃                 ┃ Value                                                                                                                                                                                                           ┃ │
    │ ┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │
    │ │          prompt │ amateur cellphone photography portrait photography of a woman in the office, wearing a black jacket, wearing a blue jeans, blonde hair, blue eyes, Nikon Z9 . f8.0, samsung galaxy, noise, jpeg artefacts, poor │ │
    │ │                 │ lighting, low light, underexposed, high contrast, <lora:detailed_hands:1.0>, hand, <lora:HandFineTuning_XL:1>, <lora:Perfect Hands:1>, perfect hands                                                            │ │
    │ │ negative_prompt │ ugly, deformed, noisy, blurry, low contrast, dark, cluttered, messy, unattractive, gloomy, distorted, watermark, logo, logotype, brand                                                                          │ │
    │ │          n_iter │ 1                                                                                                                                                                                                               │ │
    │ │      batch_size │ 1                                                                                                                                                                                                               │ │
    │ │           width │ 832                                                                                                                                                                                                             │ │
    │ │          height │ 1216                                                                                                                                                                                                            │ │
    │ │    sampler_name │ DPM++ 2M SDE                                                                                                                                                                                                    │ │
    │ │       enable_hr │ False                                                                                                                                                                                                           │ │
    │ │     hr_upscaler │ None                                                                                                                                                                                                            │ │
    │ │      checkpoint │ realismEngineSDXL_v30VAE.safetensors [2d5af23726]                                                                                                                                                               │ │
    │ │             vae │ sdxl_vae.safetensors                                                                                                                                                                                            │ │
    │ │            unet │ Automatic                                                                                                                                                                                                       │ │
    │ └─────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
    │                 ADetailer                                                                                                                                                                                                             │
    │ ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━���━━━━━━┓                                                                                                                                                                                             │
    │ ┃                     ┃ Value           ┃                                                                                                                                                                                             │
    │ ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩                                                                                                                                                                                             │
    │ │             version │ 24.8.0          │                                                                                                                                                                                             │
    │ │            ad_model │ hand_yolov8n.pt │                                                                                                                                                                                             │
    │ │           ad_prompt │                 │                                                                                                                                                                                             │
    │ │  ad_negative_prompt │                 │                                                                                                                                                                                             │
    │ │ ad_controlnet_model │ None            │                                                                                                                                                                                             │
    │ │              is_api │ True            │                                                                                                                                                                                             │
    │ └─────────────────────┴─────────────────┘                                                                                                                                                                                             │
    │ ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\webui\extensions\adetailer\aaaaaa\traceback.py:153 in wrapper    │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │   152 │   │   try:                                                                               │                                                                                                                                  │
    │ │ ❱ 153 │   │   │   return func(*args, **kwargs)                                                   │                                                                                                                                  │
    │ │   154 │   │   except Exception as e:                                                             │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\webui\extensions\adetailer\scripts\!adetailer.py:803 in          │                                                                                                                                  │
    │ │ postprocess_image                                                                                │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │    802 │   │   init_image = copy(pp.image)                                                       │                                                                                                                                  │
    │ │ ❱  803 │   │   arg_list = self.get_args(p, *args_)                                               │                                                                                                                                  │
    │ │    804 │   │   params_txt_content = self.read_params_txt()                                       │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\webui\extensions\adetailer\scripts\!adetailer.py:246 in get_args │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │    245 │   │   │   try:                                                                          │                                                                                                                                  │
    │ │ ❱  246 │   │   │   │   inp = ADetailerArgs(**arg_dict)                                           │                                                                                                                                  │
    │ │    247 │   │   │   except ValueError as e:                                                       │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │ I:\stable-diffusion-webui-forge\system\python\lib\site-packages\pydantic\v1\main.py:341 in       │                                                                                                                                  │
    │ │ __init__                                                                                         │                                                                                                                                  │
    │ │                                                                                                  │                                                                                                                                  │
    │ │    340 │   │   if validation_error:                                                              │                                                                                                                                  │
    │ │ ❱  341 │   │   │   raise validation_error                                                        │                                                                                                                                  │
    │ │    342 │   │   try:                                                                              │                                                                                                                                  │
    │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                                                                                  │
    │ ValidationError: 2 validation errors for ADetailerArgs                                                                                                                                                                                │
    │ ad_prompt                                                                                                                                                                                                                             │
    │   none is not an allowed value (type=type_error.none.not_allowed)                                                                                                                                                                     │
    │ ad_negative_prompt                                                                                                                                                                                                                    │
    │   none is not an allowed value (type=type_error.none.not_allowed)                                                                                                                                                                     │
    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

---
15:52:06 - ReActor - STATUS - Working: source face index [0], target face index [0]
15:52:06 - ReActor - STATUS - Using Loaded Source Face Model: face-model-01.safetensors
15:52:06 - ReActor - STATUS - Analyzing Target Image...
15:52:09 - ReActor - STATUS - Detecting Source Face, Index = 0
15:52:09 - ReActor - STATUS - Detected: -[33]- y.o. Male
15:52:10 - ReActor - STATUS - Detecting Target Face, Index = 0
15:52:10 - ReActor - STATUS - Detected: -25- y.o. Female
15:52:10 - ReActor - STATUS - Swapping Source into Target
15:52:14 - ReActor - STATUS - Correcting Face Mask
15:52:14 - ReActor - STATUS - Restoring the face with CodeFormer (weight: 1.0)
Cleanup minimal inference memory.

List of installed extensions

adetailer https://github.com/Bing-su/adetailer.git main 25e7509f 2024-08-03 01:20:15 unknown

clip-interrogator-ext https://github.com/pharmapsychotic/clip-interrogator-ext.git main 0f1a4591 2023-09-09 22:35:46 unknown

sd-dynamic-prompts https://github.com/adieyal/sd-dynamic-prompts.git main de056ff8 2024-05-26 16:33:58 unknown

sd-webui-infinite-image-browsing https://github.com/zanllp/sd-webui-infinite-image-browsing.git main 19927f49 2024-07-27 01:01:30 unknown

sd-webui-reactor https://github.com/Gourieff/sd-webui-reactor.git main 613b7d74 2024-06-26 11:07:09 unknown

stable-diffusion-webui-rembg https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git master a4c07b85 2023-12-30 10:04:03 unknown

stable-diffusion-webui-wildcards https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards.git master c7d49e18 2023-07-30 17:08:05 unknown

dosubot[bot] commented 1 month ago

Hey, @edusachs! I'm here to help you with any bugs or questions you have. Let's work together to solve this issue.

To resolve the ValidationError for ad_prompt and ad_negative_prompt when using the /sdapi/v1/txt2img endpoint with the ADetailer extension, ensure that these fields are correctly formatted and included in your request payload. Here is an example of how to structure your payload:

{
    "prompt": "amateur cellphone photography portrait photography of a woman in the office, wearing a black jacket, wearing a blue jeans, blonde hair, blue eyes, Nikon Z9 . f8.0, samsung galaxy, noise, jpeg artefacts, poor lighting, low light, underexposed, high contrast, <lora:detailed_hands:1.0>, hand, <lora:HandFineTuning_XL:1>, <lora:Perfect Hands:1>, perfect hands",
    "negative_prompt": "ugly, deformed, noisy, blurry, low contrast, dark, cluttered, messy, unattractive, gloomy, distorted, watermark, logo, logotype, brand",
    "seed": -1,
    "sampler_name": "DPM++ 2M SDE",
    "scheduler": "Karras",
    "steps": 60,
    "cfg_scale": 7.0,
    "width": 832,
    "height": 1216,
    "restore_faces": false,
    "vae": "sdxl_vae.safetensors",
    "clip_skip": 1,
    "alwayson_scripts": {
        "ADetailer": {
            "args": [
                {
                    "ad_model": "hand_yolov8n.pt",
                    "ad_confidence": 0.3,
                    "ad_dilate_erode": 4,
                    "ad_mask_blur": 4,
                    "ad_denoising_strength": 0.4,
                    "ad_inpaint_only_masked": true,
                    "ad_prompt": "",  // Add this field
                    "ad_negative_prompt": ""  // Add this field
                }
            ]
        },
        "reactor": {
            "args": [
                "<base64_image>",
                true,
                "0",
                "0",
                "I:\\\\stable-diffusion-webui\\\\models\\\\insightface\\\\inswapper_128.onnx",
                "CodeFormer",
                1,
                true,
                "4x_NMKD-Superscale-SP_178000_G",
                1.5,
                1,
                false,
                true,
                1,
                0,
                0,
                false,
                1.0,
                true,
                false,
                "CUDA",
                true,
                1,
                "face-model-01.safetensors",
                "I:\\\\StockMillionare\\\\01-generate-prompts\\\\faces-temp",
                null,
                false,
                false,
                0.5,
                0
            ]
        }
    }
}

If you want to use the default prompts, you can leave ad_prompt and ad_negative_prompt as empty strings. According to the ADetailer documentation, if these fields are left blank, they will use the same prompts as the input [1][2][3].

To continue talking to Dosu, mention @dosu.

edusachs commented 1 month ago

I specified the ad_prompt and ad_negative_prompt as requested, but the mentioned error is still occurring. Look at the payload:


{
    "prompt": "amateur cellphone photography portrait photography of a woman in the office, wearing a black jacket, wearing a blue jeans, blonde hair, blue eyes, Nikon Z9 . f8.0, samsung galaxy, noise, jpeg artefacts, poor lighting, low light, underexposed, high contrast, <lora:detailed_hands:1.0>, hand, <lora:HandFineTuning_XL:1>, <lora:Perfect Hands:1>, perfect hands",
    "negative_prompt": "ugly, deformed, noisy, blurry, low contrast, dark, cluttered, messy, unattractive, gloomy, distorted, watermark, logo, logotype, brand",
    "seed": -1,
    "sampler_name": "DPM++ 2M SDE",
    "scheduler": "Karras",
    "steps": 60,
    "cfg_scale": 7.0,
    "width": 832,
    "height": 1216,
    "restore_faces": false,
    "vae": "sdxl_vae.safetensors",
    "clip_skip": 1,
    "alwayson_scripts": {
        "ADetailer": {
            "args": [
                {
                    "ad_model": "hand_yolov8n.pt",
                    "ad_confidence": 0.3,
                    "ad_dilate_erode": 4,
                    "ad_mask_blur": 4,
                    "ad_denoising_strength": 0.4,
                    "ad_inpaint_only_masked": true,
                    "ad_prompt": "",
                    "ad_negative_prompt": ""
                }
            ]
        },
        "reactor": {
            "args": [
                "<base64_image>",
                true,
                "0",
                "0",
                "I:\\\\stable-diffusion-webui\\\\models\\\\insightface\\\\inswapper_128.onnx",
                "CodeFormer",
                1,
                true,
                "4x_NMKD-Superscale-SP_178000_G",
                1.5,
                1,
                false,
                true,
                1,
                0,
                0,
                false,
                1.0,
                true,
                false,
                "CUDA",
                true,
                1,
                "face-model-01.safetensors",
                "I:\\\\StockMillionare\\\\01-generate-prompts\\\\faces-temp",
                null,
                false,
                false,
                0.5,
                0
            ]
        }
    }
}
edusachs commented 1 month ago

I am a layperson in programming, but with the help of ChatGPT, I added the lines below to the file adetailer\scripts\!adetailer.py

arg_dict['ad_prompt'] = arg_dict.get('ad_prompt', '') or '' arg_dict['ad_negative_prompt'] = arg_dict.get('ad_negative_prompt', '') or ''

See how it turned out; with this, the errors stopped occurring, and ADetailer started working again.

image

wizz13150 commented 3 weeks ago

Hey,

I had the 3rd argument mentionned, but basically the same issue with ad_prompt and ad_negative_prompt. This solved my issue as well.

Thanks !🥂