stable-diffusion-webui
stable-diffusion-webui copied to clipboard
Interrogate fails (out of memory) when loading artists.csv
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:
- Go to 'Img2Img' tab
- Click on 'Interrogate' button
- 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.
Update, using the try --lowvram arg corrected the issue
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
every thing seems working fine but the interrogate button
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
same here, running on 6gb ram (nnidia 1060)
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
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
Replacing artists.csv with this cut down version, might be the lesser of two evils.
solved here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/2848
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.