AUTOMATIC1111 / stable-diffusion-webui

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

On the problem that the same resolution can not be generated stably #2293

Closed RokiRokiPoi closed 1 year ago

RokiRokiPoi commented 2 years ago

When I use stable diffusion webui, I can generate 1600 896 images, but this is unstable, and black images usually appear. Besides, if I restart webui-user.bat, I may not be able to generate 1600 896 images. I want to know why, if I can generate such a picture, why I can't generate it again because I restart it.If I really need to generate such a picture, what should I do to help me realize it?

RokiRokiPoi commented 2 years ago

4{@D 7_S2@}4~I@LT_{W`Q5 there is the error report

aleksusklim commented 2 years ago

Probably something in your system uses GPU resources too. Try this: 1) Close all other applications (especially all other browser tabs). 2) Disable hardware acceleration in your current browser (actually, you can use for this GUI one browser you like less – for example Edge or Firefox if you prefer Chrome for everyday tasks) and in other applications (notable example is Telegram Desktop).

RokiRokiPoi commented 2 years ago

Actually, I started webui when I turned on my computer, At that time, there was no software that occupied memory or video memory. but it didn't work. Still can't generate pictures.

As for the choice of browser, I'm using edge now, and I can't generate such a picture without enable the hardware acceleration, that is, nothing has changed, which is why I feel very puzzled.

ClashSAN commented 2 years ago

@RokiRokiPoi make use of --lowvram and --xformers. put both flags in commandline args in webui-user.bat. If you can't install the xformers, then --lowvram only.

..What you said above is strange, you cannot turn off hardware acceleration in the browser? Try a different one, I can disable this on Brave browser.

kryztoval commented 2 years ago

You can check how much vram you have available by using nvidia-smi command and reading the output I see you are using waifu diffusion, that model is bigger unless you have pruned it.

You may have better luck using the low ram setting mentioned by others earlier.

In my setup it uses a lot more than 4gb of ram with no optimizations: Torch active/reserved: 8835/11526 MiB, Sys VRAM: 11458/24576 MiB (46.62%)

I can try your prompt if you share the txt generator for it.

RokiRokiPoi commented 2 years ago

@ClashSAN I'm sorry for my mistake. I mean, I still can't generate such a picture even though I have turned off hardware acceleration. The last time I generated the resolution of 1600896, I used---medvram --no-half, but now I can't generate the image of 1600 896 by starting webui-user.bat even though I haven't changed anything. Now I want to continue to use --medvram and --nohalf, I tried once --lowvram, but it was too slow, and it took nearly ten minutes to generate a picture. Is xformer useful? If it can help me, I will try to install it.

RokiRokiPoi commented 2 years ago

OK, I found the problem:--no-half, delete--no-half. I can generate 1600 900 images (although many of them are black image). Can someone tell me what role --no-half has? I feel it can help me improve the image quality.I'm not sure.

aleksusklim commented 2 years ago

Can someone tell me what role --no-half has?

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting#green-or-black-screen

But you stated you have GTX 3060 6Gb, it should not matter. You don't need no-half here.

I see you are using waifu diffusion, that model is bigger unless you have pruned it.

Personally, I merged WD with itself, saving as float 16 with that checkbox in merging tab – and it gave more lightweight file.

RokiRokiPoi commented 2 years ago

@aleksusklim -- no-half really affects the quality of drawing for me, and I don't know how it is work. Even if I am a 3060, I still have black pictures, but there is no green picture.

But you stated you have GTX 3060 6Gb, it should not matter. You don't need no-half here.

I will upload those two pictures later, with the same tag and the same parameters but different results.

kryztoval commented 2 years ago

--no-half tells the model to use full precision numbers in memory instead of half precision which require less memory. The issue is that some cards do not support half precision like the GTX1650 IIRC.

Did you disable censorship? black images normally result if you create a NSFW image and did not tell the generator that NSFW was ok for you.

RokiRokiPoi commented 2 years ago

00817-1329415664-((1girl)),(Resource Integration disable the --no-half

00808-1329415664-((1girl)),(Resource Integration enable the--no-half

RokiRokiPoi commented 2 years ago

--no-half tells the model to use full precision numbers in memory instead of half precision which require less memory. The issue is that some cards do not support half precision like the GTX1650 IIRC.

Did you disable censorship? black images normally result if you create a NSFW image and did not tell the generator that NSFW was ok for you.

no,i never generate the nsfw image Maybe using nohalf is a negative optimization for me?

Turn off nohalf, my black image generation rate is much higher.

kryztoval commented 2 years ago

No half does disable an optimization. using half is faster. You only want to disable half if the gpu does not support it.

kryztoval commented 2 years ago

the images I see from your exact prompt are not even close in style to what you posted - how did you manage to get that with just 20 steps?

ClashSAN commented 2 years ago

@RokiRokiPoi xformers will nearly double your previous batch count, inferring it doubles available vram. so yes, very helpful it would auto-install and enable for you automatically. add to commandline args:

--xformers

also turn off the censorship and see if there's a difference

0xdevalias commented 2 years ago

A friend mentioned that using xformers could make things non-deterministic, and that there were a lot of references to it on the repo issues here. Wanting to understand a bit more about it, and link a bunch of potentially related issues together, I tried to find as many issues as I could that seemed to be related to xformers and the potential for it to be causing non-deterministic / unstable / inconsistent results:

The following may potentially be related (ordered by issue number):

Issues:

Discussions:

I also came across this thread in the xformers repo, which while I can't guarantee is related, am wondering if it might be:

And a question I raised on a PR in the diffusers repo: