Replies: 2 comments 4 replies
|
This doesn't belong in llama-swap core but I think it can be a nice little tool in cmd/llama-server-cache-intercept/main.go. It can pass all the cli arguments it is given and start llama-server as a child process. When it gets a SIGINT/SIGTERM it will send the POST request to save the prompt cache before sending its own SIGTERM to llama-server. To llama-swap this would look like any other process that can be started and stopped. llama-swap will send a SIGKILL after a timeout so that is something to watch out for. That could live in llama-swap as a configuration option to control how long processes get to shutdown down cleanly. |
|
I've made patch for supporting simple loading/unloading hooks: https://gist.github.com/WinPooh32/3741ca478a32a93965e2204c4cb6bc2a#file-readme-md |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
llama.cpp supports saving/restoring the prompt cache by:
--slot-save-path /pat/to/cacheon the CLI./slots/{slot_id}?action={save,restore}.It would be great if llama-swap could do this automatically when unloading/loading models (with a separate cache directory per model). This doesn't need to be super reliable, it would just be nice to be able to quickly swap between models without having to reprocess everything every time.
I can implement this with a shell-script wrapper around llama-cpp, but it's messy and unreliable. E.g., restoring the prompt cache races with the first request because, from llama-swap's perspective, llama.cpp is "ready".
All reactions