You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As llama.cpp, add sleep-idle-seconds flag to free vram when not using
Detailed Description
In my case, it would be great to have llama.cpp and stable.diffusion.cpp in the same machine at the same time, but sometimes, when not using stable or llama, free the vram for the other one or other processes.
It adds --sleep-idle-seconds N (also available as --ttl N) to unload the model context after a configurable idle period and automatically reload it on the next generation request. Active requests and queued/running jobs prevent unloading, and status/progress polling doesn't reset the idle timer. It also preserves models loaded through command-line arguments, so no recipe is required.
Initial testing with Docker, CUDA, an RTX 5060 Ti, and Open WebUI is working well. I'll do more testing before opening a PR.
@cumal I see you opened and closed a PR due to web ui not picking up models after it unloaded. I can confirm I can still see and load models after one is unloaded
Activity
cs8425 commentedon Oct 31, 2026
Currently I'm using flag
--offload-to-cputo do this: https://github.com/leejet/stable-diffusion.cpp/blob/master/docs/performance.md#offload-weights-to-the-cpu-to-save-vram-without-reducing-generation-speedIt load weights into VRAM only when needed and offload immediately when generate finish.
This may be a workaround right now.
ampersandru commentedon Nov 5, 2026
I've implemented this in my fork: feat/server-idle-sleep.
It adds
--sleep-idle-seconds N(also available as--ttl N) to unload the model context after a configurable idle period and automatically reload it on the next generation request. Active requests and queued/running jobs prevent unloading, and status/progress polling doesn't reset the idle timer. It also preserves models loaded through command-line arguments, so no recipe is required.Initial testing with Docker, CUDA, an RTX 5060 Ti, and Open WebUI is working well. I'll do more testing before opening a PR.
@cumal I see you opened and closed a PR due to web ui not picking up models after it unloaded. I can confirm I can still see and load models after one is unloaded