stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: RuntimeError: CUDA out of memory

Open nagaisa opened this issue 3 years ago • 9 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

every time i try and genatre an image it fails after a few sec and gives RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 6.00 GiB total capacity; 5.26 GiB already allocated; 0 bytes free; 5.33 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF this sometimes aslo shows during starting up. it did work for a little bit but after a wale this started happing, reinstalling did not help nor did any older versions.

Steps to reproduce the problem

  1. Go to install dir
  2. Press run wepui-user (or launch.py) with args --xformers --opt-split-attention --precision full --no-half
  3. enter prompt and try an generate

What should have happened?

memory should be cleared, and be able to generate

Commit where the problem happens

6bd6154a92eb05c80d66df661a38f8b70cc13729

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--xformers --opt-split-attention --precision full --no-half

Additional information, context and logs

GPU:NVIDIA GeForce GTX 1660 Ti log: image

nagaisa avatar Oct 23 '22 22:10 nagaisa

Is 6GB actually enough?

enn-nafnlaus avatar Oct 23 '22 22:10 enn-nafnlaus

try with --medvram ?

ClashSAN avatar Oct 23 '22 22:10 ClashSAN

I sometimes got this specific 20MiB CUDA OOM Error when I was still loading the nai.YAML file. If you are loading the .yaml on startup, back up the .yaml somewhere and remove it from your models/stable-diffusion folder.

Leon-Schoenbrunn avatar Oct 23 '22 22:10 Leon-Schoenbrunn

try with --medvram ?

will give it a try again, tho last times i had it enabled it still happened

nagaisa avatar Oct 24 '22 00:10 nagaisa

try with --medvram ?

will give it a try again, tho last time i had it enabled it still happened

so seams it can actually run now tho i only did it once, not sure if it will happen again in some time. will do more testing to find out

nagaisa avatar Oct 24 '22 00:10 nagaisa

Try without --precision full --no-half commands, maybe... When I used these, I also ran into memory errors, even though I have a 12 GB card.

mykeehu avatar Oct 24 '22 06:10 mykeehu

Still happening when I change between model. I have to restart the BAT file every time. I wanted to make a X/Y output and is imposible.

image

it used to work normally a few days ago

SoftwareLogico avatar Oct 24 '22 17:10 SoftwareLogico

Try without --precision full --no-half commands, maybe... When I used these, I also ran into memory errors, even though I have a 12 GB card.

Running without this just causing output images to be black

nagaisa avatar Oct 25 '22 13:10 nagaisa

In case anyone needs it. I solved it by making a clean installation. No pulling, no replacing files.

clean one. I just (of course) copied the: -models folder -embeddings folder (in case you have anything there) -output folder (in case you wan to keep your creations)

I have a rtx 3070 ti 8gb

set COMMANDLINE_ARGS=--listen --no-half --precision full --port 9999 --disable-safe-unpickle --deepdanbooru

now it works perfect and I can change between models and creates X/Y comparisons

SoftwareLogico avatar Oct 25 '22 13:10 SoftwareLogico

@nagaisa is running sd on an old card that is unable to run the model in float 16, only the 3XXX (newer) cards, can do it. Float 16 will use less vram.

those parameters --precision full --no-half are needed to run in float 32. Use the --medvram argument, or even --lowvram when you're needing larger images. Disable browser hardware acceleration.

These should prevent OOM issues.

ClashSAN avatar Oct 26 '22 13:10 ClashSAN

its bean a bit but i still am running into the issue somewhat

nagaisa avatar Nov 07 '22 19:11 nagaisa

In case anyone needs it. I solved it by making a clean installation. No pulling, no replacing files.

clean one. I just (of course) copied the: -models folder -embeddings folder (in case you have anything there) -output folder (in case you wan to keep your creations)

I have a rtx 3070 ti 8gb

set COMMANDLINE_ARGS=--listen --no-half --precision full --port 9999 --disable-safe-unpickle --deepdanbooru

now it works perfect and I can change between models and creates X/Y comparisons

Now it doesn't work for me anymore: This site can’t be reachedThe webpage at http://0.0.0.0:7420/ might be temporarily down or it may have moved permanently to a new web address. ERR_ADDRESS_INVALID

Florencia007 avatar Jan 26 '23 00:01 Florencia007

In case anyone needs it. I solved it by making a clean installation. No pulling, no replacing files. clean one. I just (of course) copied the: -models folder -embeddings folder (in case you have anything there) -output folder (in case you wan to keep your creations) I have a rtx 3070 ti 8gb set COMMANDLINE_ARGS=--listen --no-half --precision full --port 9999 --disable-safe-unpickle --deepdanbooru now it works perfect and I can change between models and creates X/Y comparisons

Now it doesn't work for me anymore: This site can’t be reachedThe webpage at http://0.0.0.0:7420/ might be temporarily down or it may have moved permanently to a new web address. ERR_ADDRESS_INVALID

try with 127.0.0.1:7420

SoftwareLogico avatar Jan 26 '23 01:01 SoftwareLogico

I am pretty sure the argument --port 9999 means it will be at http://127.0.0.1:9999

tomasreichmann avatar Mar 21 '23 10:03 tomasreichmann

I have a NVIDIA GTX 1660 Ti SUPER, but all methods dont work

OlegXio avatar Apr 13 '23 04:04 OlegXio

@OlegXio i have the exact same gpu did you fix the issue?

notsungod avatar Dec 29 '23 00:12 notsungod

No, I didn't fix the problem. I'm just temporarily not using SD until the issue is resolved

OlegXio avatar Dec 29 '23 05:12 OlegXio