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

Interrogate fails (out of memory) when loading artists.csv

Open Chubler-XL opened this issue 2 years ago • 9 comments

Describe the bug When using Img2Img "Interrogate" button I get the following error:

RuntimeError: CUDA out of memory. Tried to allocate 678.00 MiB (GPU 0; 6.00 GiB total capacity; 4.65 GiB already allocated; 0 bytes free; 4.81 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

regardless of the image used.

I did find that reducing the records in artists.csv from shipped 3049 records down to 1200 or less stops the error and artist name appears.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Img2Img' tab
  2. Click on 'Interrogate' button
  3. No description of image appears with "" at the end.

Expected behavior Expect description for the image with an artist name instead of <Error>

Error Stack trace output:

Error interrogating Traceback (most recent call last): File "C:\stable-diffusion-webui-master\modules\interrogate.py", line 152, in interrogate artist = self.rank(image_features, ["by " + artist.name for artist in shared.artist_db.artists])[0] File "C:\stable-diffusion-webui-master\modules\interrogate.py", line 103, in rank text_features = self.clip_model.encode_text(text_tokens).type(self.dtype) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\clip\model.py", line 348, in encode_text x = self.transformer(x) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\clip\model.py", line 203, in forward return self.resblocks(x) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\container.py", line 139, in forward input = module(input) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\clip\model.py", line 191, in forward x = x + self.mlp(self.ln_2(x)) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\container.py", line 139, in forward input = module(input) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "C:\stable-diffusion-webui-master\venv\lib\site-packages\clip\model.py", line 168, in forward return x * torch.sigmoid(1.702 * x)

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Commit revision [sorry this did not appear in the web-ui.bat output]

Additional context I know previously this was related to vmem on the GPU, I have workaround of reducing number of artists in csv. Curious if investing in new GPU with more RAM will solve this.

Chubler-XL avatar Oct 07 '22 06:10 Chubler-XL

Update, using the try --lowvram arg corrected the issue

Chubler-XL avatar Oct 07 '22 19:10 Chubler-XL

I have almost the same issue the interrogate button seems not working it keeps showing loading on it. I don't know how to fix it

CryptoSoltan avatar Oct 23 '22 18:10 CryptoSoltan

image every thing seems working fine but the interrogate button

CryptoSoltan avatar Oct 23 '22 18:10 CryptoSoltan

TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

CryptoSoltan avatar Oct 23 '22 19:10 CryptoSoltan

same here, running on 6gb ram (nnidia 1060)

rhetoricaldeviation avatar Oct 28 '22 12:10 rhetoricaldeviation

Update, using the try --lowvram arg corrected the issue

where did u enter this please? When first launching webui-user.bat? Should I alter the bat file to do this? @Chubler-XL

rhetoricaldeviation avatar Oct 28 '22 12:10 rhetoricaldeviation

Update, using the try --lowvram arg corrected the issue

where did u enter this please? When first launching webui-user.bat? Should I alter the bat file to do this? @Chubler-XL

Yes, assuming you are using windows, you update webui-user.bat (webui-user.sh for linux) and put the argument in COMMANDLINE_ARGS:

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--lowvram

Or you may get away with --medvram

BTW, I did end up getting an RTX 3060 with 12GB ram and this solved the problem without the need for --lowvram, which slows things down a lot. If this is the only thing giving you issues you may be better off with a smaller artists.csv

artists_small.csv

Replacing artists.csv with this cut down version, might be the lesser of two evils.

Chubler-XL avatar Oct 31 '22 20:10 Chubler-XL

solved here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/2848

CryptoSoltan avatar Nov 01 '22 11:11 CryptoSoltan

solved here: #2848

Your problem is has a similar symptom but is caused by something different. Anyone getting out of memory issues loading shared.artist_db.artists is not going to get any joy looking at this linked solution.

Chubler-XL avatar Nov 01 '22 18:11 Chubler-XL