lshqqytiger / stable-diffusion-webui-amdgpu

Stable Diffusion web UI
GNU Affero General Public License v3.0
1.68k stars 175 forks source link

[Bug]: Inpainting suddenly stopped working #87

Open mr-september opened 1 year ago

mr-september commented 1 year ago

Is there an existing issue for this?

What happened?

Been using this extensively for a week... today suddenly inpainting stopped working halfway through. All output images are either exactly the input image, or with the blurred mask.

Steps to reproduce the problem

  1. Try to do any inpainting
  2. Get back original image or the with the blurred mask.

What should have happened?

Inpainted image

Commit where the problem happens

fd59537

What platforms do you use to access the UI ?

Windows 11, AMD 5700

What browsers do you use to access the UI ?

Opera

Command Line Arguments

--opt-sub-quad-attention --medvram --disable-nan-check --autolaunch --api --cors-allow-origins=http://127.0.0.1:3456

I have tried enabling these either individually or in combination, to no avail:
--precision full --no-half --opt-split-attention-v1

List of extensions

Extension | URL | Version | Update -- | -- | -- | -- StylePile | https://github.com/some9000/StylePile.git | 85b549a1 (Thu Apr 13 18:42:34 2023) | unknown batch-face-swap | https://github.com/kex0/batch-face-swap.git | 60e259d8 (Thu Mar 16 02:02:46 2023) | unknown infinite-zoom-automatic1111-webui | https://github.com/v8hid/infinite-zoom-automatic1111-webui.git | b693c79f (Mon Apr 17 03:25:58 2023) | unknown multidiffusion-upscaler-for-automatic1111 | https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111.git | f3d79a47 (Sat Apr 15 17:29:10 2023) | unknown openOutpaint-webUI-extension | https://github.com/zero01101/openOutpaint-webUI-extension.git | 5e84d6d5 (Mon Apr 10 23:01:41 2023) | unknown sd-dynamic-prompts | https://github.com/adieyal/sd-dynamic-prompts.git | 9e7be4a2 (Sun Apr 16 07:55:24 2023) | unknown sd-extension-aesthetic-scorer | https://github.com/vladmandic/sd-extension-aesthetic-scorer.git | a35fb67a (Thu Apr 13 15:18:56 2023) | unknown sd-webui-3d-open-pose-editor | https://github.com/nonnonstop/sd-webui-3d-open-pose-editor.git | f2d5aac5 (Sat Apr 15 13:21:06 2023) | unknown sd-webui-ar | https://github.com/alemelis/sd-webui-ar.git | 9df49dc2 (Wed Apr 12 09:23:17 2023) | unknown sd-webui-controlnet | https://github.com/Mikubill/sd-webui-controlnet.git | 880bb7e3 (Mon Apr 17 06:41:09 2023) | unknown stable-diffusion-webui-Prompt_Generator | https://github.com/imrayya/stable-diffusion-webui-Prompt_Generator.git | 0d4de20f (Fri Mar 17 11:22:15 2023) | unknown stable-diffusion-webui-state | https://github.com/ilian6806/stable-diffusion-webui-state.git | 4cc8fa3c (Tue Apr 11 10:25:08 2023) | unknown ultimate-upscale-for-automatic1111 | https://github.com/Coyote-A/ultimate-upscale-for-automatic1111.git | 0a3d03a4 (Tue Feb 7 06:07:23 2023) | unknown

Console logs

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Commit hash: fd59537df9420bb14c1d6330ec59e30ce870a481
Installing requirements for Web UI
Installing requirements for Batch Face Swap

Installing requirements 1 for Infinite-Zoom

Interrogations are fallen back to cpu. This doesn't affect on image generation. But if you want to use interrogate (CLIP or DeepBooru), check out this issue: https://github.com/lshqqytiger/stable-diffusion-webui-directml/issues/10
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled

Installing sd-dynamic-prompts requirements.txt

Installing sd-webui-controlnet requirement: opencv-contrib-python==4.7.0.68

Launching Web UI with arguments: --opt-sub-quad-attention --medvram --opt-split-attention-v1 --disable-nan-check --autolaunch --api --cors-allow-origins=http://127.0.0.1:3456
Interrogations are fallen back to cpu. This doesn't affect on image generation. But if you want to use interrogate (CLIP or DeepBooru), check out this issue: https://github.com/lshqqytiger/stable-diffusion-webui-directml/issues/10
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
No module 'xformers'. Proceeding without it.
Loading weights [6482f11700] from E:\stable-diffusion-webui-directml\models\Stable-diffusion\realisticVisionV20_v20-inpainting.safetensors
Creating model from config: E:\stable-diffusion-webui-directml\configs\v1-inpainting-inference.yaml
LatentInpaintDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.54 M params.
Loading VAE weights specified in settings: E:\stable-diffusion-webui-directml\models\VAE\vae-ft-mse-840000-ema-pruned.ckpt
Applying sub-quadratic cross attention optimization.
Textual inversion embeddings loaded(2): easynegative, ng_deepnegative_v1_75t
Model loaded in 2.5s (load weights from disk: 0.2s, create model: 0.5s, apply weights to model: 0.8s, apply half(): 0.7s, load VAE: 0.3s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 16.3s (import torch: 2.2s, import gradio: 1.2s, import ldm: 0.6s, other imports: 1.3s, setup codeformer: 0.2s, load scripts: 2.5s, load SD checkpoint: 2.8s, create ui: 5.2s, gradio launch: 0.2s).
100%|██████████████████████████████████████████████████████████████████████████████████| 13/13 [00:14<00:00,  1.13s/it]
100%|██████████████████████████████████████████████████████████████████████████████████| 13/13 [00:12<00:00,  1.07it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 13/13 [00:16<00:00,  1.23s/it]
100%|██████████████████████████████████████████████████████████████████████████████████| 13/13 [00:13<00:00,  1.00s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 52/52 [01:04<00:00,  1.23s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 52/52 [01:04<00:00,  1.03it/s]

Additional information

I have tried:

  1. Restart webui bat
  2. Restart computer
  3. Fresh git pull
  4. Various commandline_args (detailed above)
  5. Changing checkpoint/models
  6. Adjust literally every single setting under "inpainting"
  7. Deleting the venv folder to force-update everything as suggested in issue 77. torch-directml "Version: 0.1.13.1.dev230413"
revons1984 commented 1 year ago

I found this issue on the main branch as well, the problem is with the VAE, add --no-half-vae to your command line arguments @mr-september

thonsm06 commented 1 year ago

These are my current command line arguments, --autolaunch --opt-sub-quad-attention --opt-split-attention-v1 --no-half-vae --precision full --no-half --disable-nan-check

So far everything is working.

I needed to keep --no-half for inpainting to work.

Windows 10, 6900xt.

Convexity-ai commented 1 year ago

Is the workaround above the only solution to getting inpainting working and are there any plans to investigate this further? This seems specific to using the inpainting feature with half precision. @lshqqytiger

In testing the following behaviour occurs:

Fill: The targeted area remains pale and no filling is done. Original: Slight burn is seen on the targeted area but no variance in the image is made. Latent noise: The targeted area remains pale and no variance in the image is made. Latent nothing: The targeted area remains pale and no variance in the image is made.

This issue doesn't seem to be model, VAE, or sampler specific either.

Build: 108ada8 Arguments used: --medvram --opt-sub-quad-attention

Ideally, I'd like to use half precision for image generation / inpainting due to speed/VRAM use, but so far the only way I can get inpainting to work at all is to add the --no-half argument.

lshqqytiger commented 1 year ago

Because DirectML does not natively support autocast, I implemented it by myself. So, it can be quite different from its native implementation of torch and hardly provide any improvement on performance or VRAM side. I can't access the source code of DirectML because it is not an open-source software, I can't do much about half precision.

Bod9001 commented 1 year ago

when you run with without --no-half, in painting is very strange, it looks like what it does though is

image

any pixels along the top of the image stretch down all the way, then the mask is rotated by 90° grid-0019

Hopefully this can narrow down the issue

mr-september commented 1 year ago

@Bod9001 that's a very interesting find!

Some quick updates on my end: Maybe it's part of the teething issues from Auto1111/DirectML, but this issue (inpainting not working) and other issues (img-2-img not working, sometimes the "show extra networks" doesn't work) seem to randomly come and go. No updates or restarts or whatevers apparently fix or cause them. Truly very mysterious.

Yeetmeister92 commented 1 year ago

I found this issue on the main branch as well, the problem is with the VAE, add --no-half-vae to your command line arguments @mr-september

Hey Im a big noob. How do I just add stuff to the command line arguments?

Im on windows 10 and 6700xt GPU. Gives me the same blur

Elise96nl commented 1 month ago

redownload models. put in in seperate folder (fixed models) and give it a hard read only attribute. Use seperate checkpoint for adetailer, so it has to reload between txt2image and adetailer. also allow only 1 model in memory.

I've had no nans errors after doing that