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

I switch Model.ckpt,but ram continued overlay

Open horoabb opened this issue 2 years ago • 16 comments

run webui,I switch Model.ckpt,but ram continued overlay.its dont drop

Ubuntu 22.04.1 LTS Docker Compose version v2.14.1

i use aws to g5.2xlarge(gpu:24G ram:32G)

1.no docker: ram use 3609mb 2.start docker to webui :ram use:8583mb 3. fast switch Model(ckpt): ram use:22141mb 4. second switch : ram use:28738mb 5. three : ram use:30236mb

ram dont drop,so possible docker Out of memory 0

1

fast

seond

three

horoabb avatar Feb 09 '23 03:02 horoabb

Memory leaks are somewhat normal in A1111. I don't know if this is a case in other webui's, but you have not specified which ui your bug report is refering to. Maybe it would be better if you fill in details in bug form, so we could help you better?

From my perspective, using ckpt leaks memory in A1111 greatly. This was main reason I switched to safetensor model format. Now I am happy. Models are loading much faster, and there are some minor leaks comparing to ckpt format.

DevilaN avatar Feb 09 '23 08:02 DevilaN

i use https://github.com/AbdBarho/stable-diffusion-webui-docker/

horoabb avatar Feb 09 '23 08:02 horoabb

how to use safetensor model

horoabb avatar Feb 09 '23 08:02 horoabb

@horoabb: All of us here are using this repository. This is main reason we are discussing here. You have to use one of profiles:

  • auto(-cpu)
  • invoke
  • sygil(-sl)

Which one of those? Also if you do not understand things in bug report form, then please ask first so there is no confusion later :-)

DevilaN avatar Feb 09 '23 08:02 DevilaN

auto

horoabb avatar Feb 09 '23 09:02 horoabb

So I can suggest installing this extension: https://github.com/arenatemp/stable-diffusion-webui-model-toolkit It will provide new tab with toolkit that converts models from ckpt to safetensor format and also removes data that do not contribute to model at all.

DevilaN avatar Feb 09 '23 11:02 DevilaN

ok,i try it, thanks

horoabb avatar Feb 10 '23 01:02 horoabb

Yeah, when u use the a11 webui in docker, there will be memory leak. But sometimes if u only use that on the original linux, it still there. I met this peoblem last week, and I back the version of gradio then fix it on the ori-linux. But in docker I failed, maybe safetensor can work, I'll try it later......

Alfred-Duncan avatar Feb 13 '23 03:02 Alfred-Duncan

@Alfred-Duncan: any details of you fix? Maybe somebody else could find a way to fix memory leaks starting with your info.

DevilaN avatar Feb 14 '23 10:02 DevilaN

Just create data/config/auto/startup.sh as following.

# Workaround for memory leak
if [[ ! -L "/usr/lib/x86_64-linux-gnu/libtcmalloc.so" ]]; then
  apt-get -y install libgoogle-perftools-dev
fi
export LD_PRELOAD=libtcmalloc.so

nonnonstop avatar Feb 18 '23 15:02 nonnonstop

where in join export LD_PRELOAD=libtcmalloc.so

horoabb avatar Feb 21 '23 08:02 horoabb

@nonnonstop Your solution works wonders! Probably it should be incorporated into image as memory leaks are very annoying thing in A1111 (@AbdBarho ?). Thanks one more time!

DevilaN avatar Feb 21 '23 09:02 DevilaN

只需要創建data/config/auto/startup.sh如下。

# Workaround for memory leak
if [[ ! -L "/usr/lib/x86_64-linux-gnu/libtcmalloc.so" ]]; then
  apt-get -y install libgoogle-perftools-dev
fi
export LD_PRELOAD=libtcmalloc.so

this (data/config/auto/startup.sh) is to linux or stable-diffusion-webui

horoabb avatar Feb 22 '23 03:02 horoabb

@horoabb the data directory is in your stable-diffusion-webui-docker directory

patlamontagne avatar Feb 22 '23 04:02 patlamontagne

@horoabb該data目錄在您的stable-diffusion-webui-docker目錄中

but ,i try to here (stable-diffusion-webui-docker/data/config/auto/startup.sh), no effect

horoabb avatar Feb 22 '23 05:02 horoabb

1 2 no effect

horoabb avatar Feb 22 '23 05:02 horoabb

I did not see any benefits on my side, but I will add this nonetheless, not sure if it has any side effects that we are not aware of.

AbdBarho avatar Feb 23 '23 20:02 AbdBarho