Bing-su / adetailer

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

[Bug]: Adetailer generates grey box on faces using SDNext #250

Closed devils-shadow closed 1 year ago

devils-shadow commented 1 year ago

Describe the bug

Using @Bing-su's Adetailer on any image will generate a grey box in the place of detected faces. Using the latest version of Adetailer from the extension section of the webui. Please note that using Adetailer with @lshqqytiger's SD fork does not cause this issue fork git link

image

Using the same prompt, checkpoint and VAE in both builds, only SDnext exhibits this effect.

My SDNext install is fresh (version 01804025), and I'm using the following launch parameters:

For SDNext: --use-directml --lowvram --debug (using sub-quadratic cross attention and disabled NaN check in settings) For @lshqqytiger's directml fork: --opt-sub-quad-attention --lowvram --disable-nan-check --no-half

The strange thing is i somehow got Adetailer working last night but today it no longer works again.

Here's a screenshot of a section of settings I'm thinking might have something to do with why the extension works for one fork works and the other doesn't. I wasn't able to find an equivalent to these settings in the SD directML build by @lshqqytiger

image

I'm fairly new to SD and its intricacies and any help would be greatly appreciated!

Screenshots

No response

Console logs, from start to end.

Using VENV: E:\SD\automatic\venv
16:50:30-417464 INFO     Starting SD.Next
16:50:30-436747 INFO     Python 3.10.11 on Windows
16:50:30-525386 INFO     Version: 01804025 Sun Jul 30 11:36:47 2023 +0300
16:50:30-931643 DEBUG    Setting environment tuning
16:50:30-933249 DEBUG    Torch overrides: cuda=False rocm=False ipex=False diml=True
16:50:30-935518 DEBUG    Torch allowed: cuda=False rocm=False ipex=False diml=True
16:50:30-936870 INFO     Using DirectML Backend
16:50:31-086628 WARNING  Modified files: ['modules/lycoris']
16:50:31-140305 DEBUG    Repository update time: Sun Jul 30 11:36:47 2023
16:50:31-142077 DEBUG    Previous setup time: Sun Jul 30 15:13:42 2023
16:50:31-142077 INFO     Disabled extensions: []
16:50:31-142077 INFO     Enabled extensions-builtin: ['a1111-sd-webui-lycoris', 'clip-interrogator-ext', 'LDSR',
                         'Lora', 'multidiffusion-upscaler-for-automatic1111', 'ScuNET', 'sd-dynamic-thresholding',
                         'sd-extension-system-info', 'sd-webui-agent-scheduler', 'sd-webui-controlnet',
                         'stable-diffusion-webui-images-browser', 'stable-diffusion-webui-rembg', 'SwinIR']
16:50:31-149580 INFO     Enabled extensions: ['a1111-sd-webui-tagcomplete', 'adetailer']
16:50:31-151270 DEBUG    Latest extensions time: Sun Jul 30 15:13:33 2023
16:50:31-151270 DEBUG    Timestamps: version:1690706207 setup:1690719222 extension:1690719213
16:50:31-153979 INFO     No changes detected: Quick launch active
16:50:31-154483 INFO     Verifying requirements
16:50:31-165500 INFO     Disabled extensions: []
16:50:31-165500 INFO     Enabled extensions-builtin: ['a1111-sd-webui-lycoris', 'clip-interrogator-ext', 'LDSR',
                         'Lora', 'multidiffusion-upscaler-for-automatic1111', 'ScuNET', 'sd-dynamic-thresholding',
                         'sd-extension-system-info', 'sd-webui-agent-scheduler', 'sd-webui-controlnet',
                         'stable-diffusion-webui-images-browser', 'stable-diffusion-webui-rembg', 'SwinIR']
16:50:31-165500 INFO     Enabled extensions: ['a1111-sd-webui-tagcomplete', 'adetailer']
16:50:31-165500 INFO     Extension preload: 0.0s E:\SD\automatic\extensions-builtin
16:50:31-181131 INFO     Extension preload: 0.0s E:\SD\automatic\extensions
16:50:31-202455 DEBUG    Memory used: 0.04 total: 15.4 Collected 0
16:50:31-203905 DEBUG    Starting module: <module 'webui' from 'E:\\SD\\automatic\\webui.py'>
16:50:31-203905 INFO     Server arguments: ['--use-directml', '--lowvram', '--debug']
16:50:31-220251 DEBUG    Loading Torch
16:50:38-293380 DEBUG    Loading Gradio
16:50:39-071382 DEBUG    Loading Modules
No module 'xformers'. Proceeding without it.
16:50:40-581754 DEBUG    Reading: E:\SD\automatic\config.json len=336
16:50:40-581754 INFO     Pipeline: Backend.ORIGINAL
16:50:40-581754 DEBUG    Loaded styles: E:\SD\automatic\styles.csv 16
16:50:41-444323 DEBUG    Samplers enumerated: ['UniPC', 'DDIM', 'PLMS', 'Euler a', 'Euler', 'DPM++ 2S a', 'DPM++ 2S a
                         Karras', 'DPM++ 2M', 'DPM++ 2M Karras', 'DPM++ SDE', 'DPM++ SDE Karras', 'DPM++ 2M SDE',
                         'DPM++ 2M SDE Karras', 'DPM fast', 'DPM adaptive', 'DPM2', 'DPM2 Karras', 'DPM2 a', 'DPM2 a
                         Karras', 'LMS', 'LMS Karras', 'Heun']
16:50:41-492754 INFO     Libraries loaded
16:50:41-492754 DEBUG    Entering start sequence
16:50:41-599981 DEBUG    Version: {'app': 'sd.next', 'updated': '2023-07-30', 'hash': '01804025', 'url':
                         'https://github.com/vladmandic/automatic/tree/master'}
16:50:41-599981 INFO     Using data path: E:\SD\automatic
16:50:41-603984 DEBUG    Event loop: <_WindowsSelectorEventLoop running=False closed=False debug=False>
16:50:41-603984 DEBUG    Entering initialize
16:50:41-603984 INFO     Available VAEs: E:\SD\webui\stable-diffusion-webui-directml\models\VAE 2
16:50:41-603984 DEBUG    Reading: E:\SD\automatic\cache.json len=2
16:50:41-614673 DEBUG    Reading: E:\SD\automatic\metadata.json len=20
16:50:41-620779 INFO     Available models: E:\SD\webui\stable-diffusion-webui-directml\models\Stable-diffusion 9
16:50:41-669299 DEBUG    Loading scripts
16:50:43-934364 INFO     ControlNet v1.1.234
ControlNet v1.1.234
ControlNet preprocessor location: E:\SD\automatic\extensions-builtin\sd-webui-controlnet\annotator\downloads
16:50:44-073701 INFO     ControlNet v1.1.234
ControlNet v1.1.234
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: 23.7.10, num models: 9
16:50:48-382764 DEBUG    Scripts load: ['a1111-sd-webui-lycoris:1.246s', 'Lora:0.188s',
                         'sd-extension-system-info:0.075s', 'sd-webui-agent-scheduler:0.405s',
                         'sd-webui-controlnet:0.343s', 'stable-diffusion-webui-images-browser:0.11s',
                         'stable-diffusion-webui-rembg:1.099s', 'a1111-sd-webui-tagcomplete:0.086s',
                         'adetailer:2.923s']
Scripts load: ['a1111-sd-webui-lycoris:1.246s', 'Lora:0.188s', 'sd-extension-system-info:0.075s', 'sd-webui-agent-scheduler:0.405s', 'sd-webui-controlnet:0.343s', 'stable-diffusion-webui-images-browser:0.11s', 'stable-diffusion-webui-rembg:1.099s', 'a1111-sd-webui-tagcomplete:0.086s', 'adetailer:2.923s']
16:50:48-523954 INFO     Loading UI theme: name=black-orange style=Auto
16:50:48-528422 DEBUG    Creating UI
16:50:48-540551 DEBUG    Reading: E:\SD\automatic\ui-config.json len=0
16:50:48-569927 DEBUG    Extra networks: checkpoints items=9 subdirs=0
16:50:48-864031 DEBUG    Reading: E:\SD\automatic\ui-config.json len=0
16:50:49-509155 DEBUG    Script: 0.52s ui_tabs
                         E:\SD\automatic\extensions-builtin\stable-diffusion-webui-images-browser\scripts\image_browse
                         r.py
16:50:49-509155 DEBUG    Extensions list loaded: E:\SD\automatic\html\extensions.json
16:50:50-554756 DEBUG    Extension list refresh: processed=197 installed=15 enabled=15 disabled=0 visible=197 hidden=0
Running on local URL:  http://127.0.0.1:7860
16:50:50-867646 INFO     Local URL: http://127.0.0.1:7860/
16:50:50-867646 DEBUG    Gradio registered functions: 1973
16:50:50-867646 INFO     Initializing middleware
16:50:50-867646 DEBUG    Creating API
16:50:50-993964 INFO     [AgentScheduler] Task queue is empty
16:50:50-993964 INFO     [AgentScheduler] Registering APIs
16:50:51-120839 DEBUG    Scripts setup: ['Tiled Diffusion:0.022s', 'ControlNet:0.036s', 'ADetailer:0.082s']
16:50:51-120839 DEBUG    Scripts components: []
16:50:51-120839 DEBUG    Model metadata: E:\SD\automatic\metadata.json no changes
16:50:51-262805 DEBUG    Select checkpoint: model abyssorangemix3AOM3_aom3a1b.safetensors [5493a0ec49]
16:50:51-278663 DEBUG    Load model weights: existing=False
                         target=E:\SD\webui\stable-diffusion-webui-directml\models\Stable-diffusion\abyssorangemix3AOM
                         3_aom3a1b.safetensors info=None
16:50:51-586044 DEBUG    gc: collected=10222 device=privateuseone:0 {'ram': {'used': 0.85, 'total': 15.4}, 'gpu':
                         {'used': 0.24, 'total': 0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
Loading weights: E:\SD\webui\stable-diffusion-webui-directml\models\Stable-diffusion\abyssorangemix3AOM3_aom3a1b.saf…
16:50:51-872221 DEBUG    Load model:
                         name=E:\SD\webui\stable-diffusion-webui-directml\models\Stable-diffusion\abyssorangemix3AOM3_
                         aom3a1b.safetensors dict=True
16:50:51-872221 DEBUG    Verifying Torch settings
16:50:51-885646 DEBUG    Torch FP16 test passed
16:50:51-886725 DEBUG    Desired Torch parameters: dtype=FP16 no-half=False no-half-vae=False upscast=False
16:50:51-886725 INFO     Setting Torch parameters: dtype=torch.float16 vae=torch.float16 unet=torch.float16
16:50:51-886725 DEBUG    Torch default device: privateuseone:0
16:50:51-886725 DEBUG    Model dict loaded: {'ram': {'used': 0.86, 'total': 15.4}, 'gpu': {'used': 0.24, 'total':
                         0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
16:50:51-903840 DEBUG    Model config loaded: {'ram': {'used': 0.86, 'total': 15.4}, 'gpu': {'used': 0.24, 'total':
                         0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
16:50:52-311995 DEBUG    Model created from config: E:\SD\automatic\configs\v1-inference.yaml
16:50:52-311995 DEBUG    Model weights loading: {'ram': {'used': 1.82, 'total': 15.4}, 'gpu': {'used': 0.24, 'total':
                         0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
Loading weights: E:\SD\webui\stable-diffusion-webui-directml\models\VAE\vae-ft-mse-840000-ema-pruned.safetensors ━  -…
16:50:58-660148 DEBUG    Model weights loaded: {'ram': {'used': 5.01, 'total': 15.4}, 'gpu': {'used': 0.24, 'total':
                         0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
16:50:58-674173 DEBUG    Model weights moved: {'ram': {'used': 5.01, 'total': 15.4}, 'gpu': {'used': 0.24, 'total':
                         0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
16:50:58-676180 INFO     Applying sub-quadratic cross attention optimization
16:50:58-700002 INFO     Embeddings: loaded=0 skipped=0
16:50:58-709094 INFO     Model loaded in 7.1s (load=0.3s create=0.4s apply=4.8s vae=1.5s)
16:50:59-172291 DEBUG    gc: collected=97 device=privateuseone:0 {'ram': {'used': 5.01, 'total': 15.4}, 'gpu':
                         {'used': 0.24, 'total': 0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
16:50:59-172291 INFO     Model load finished: {'ram': {'used': 5.01, 'total': 15.4}, 'gpu': {'used': 0.24, 'total':
                         0.5}, 'retries': 'DirectMLDevice', 'oom': 0} cached=0
16:50:59-855178 DEBUG    gc: collected=0 device=privateuseone:0 {'ram': {'used': 3.02, 'total': 15.4}, 'gpu': {'used':
                         0.24, 'total': 0.5}, 'retries': 'DirectMLDevice', 'oom': 0}
16:50:59-855178 INFO     Startup time: 28.6s (torch=7.1s gradio=0.8s libraries=2.4s vae=0.1s scripts=6.7s
                         onchange=0.1s ui-txt2img=0.2s ui-img2img=0.1s ui-settings=0.1s ui-extensions=1.6s
                         ui-defaults=0.1s launch=0.2s app-started=0.3s checkpoint=8.7s)

List of installed extensions

https://github.com/Bing-su/adetailer https://github.com/DominikDoom/a1111-sd-webui-tagcomplete

devils-shadow commented 1 year ago

Fixed by adding the --experimental launch parameter and then enabling use full precision model (--no-half)

Hope this helps others in the future when it comes to SDNext and Adetailer!

devils-shadow commented 1 year ago

Closing issue