Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchedExecutor Save/Load #681

Conversation

martindevans
Copy link
Member

Added the ability to save and load individual conversations in a batched executor.

  • Added BatchedExecutor.Load(filepath) method
  • Added Conversation.Save(filepath) method
  • Added new (currently internal) SaveState/LoadState methods in LLamaContext which can stash some extra binary data in the header. This can be used where other state needs to be saved alongside the raw KV cache.
  • New example showing saving/loading a conversation

…hed executor.

 - New example
 - Added `BatchedExecutor.Load(filepath)` method
 - Added `Conversation.Save(filepath)` method
 - Added new (currently internal) `SaveState`/`LoadState` methods in LLamaContext which can stash some extra binary data in the header
Copy link
Contributor

@Lyrcaxis Lyrcaxis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

LLama/LLamaContext.cs Outdated Show resolved Hide resolved
LLama/LLamaContext.cs Outdated Show resolved Hide resolved
@martindevans
Copy link
Member Author

I've just added the ability to save and load an entire Conversation to an in-memory State object, instead of to file.

This was inspired by some of the scheduler stuff @AsakusaRinne has been talking about. With this a scheduler could "swap out" a Conversation object and dispose it, freeing up space in the KV cache for other conversations to be evaluated, all without touching disk.

@zsogitbe
Copy link
Contributor

I've just added the ability to save and load an entire Conversation to an in-memory State object, instead of to file.

This was inspired by some of the scheduler stuff @AsakusaRinne has been talking about. With this a scheduler could "swap out" a Conversation object and dispose it, freeing up space in the KV cache for other conversations to be evaluated, all without touching disk.

Multi-model execution is an important use case. Having such a scheduler would be very useful. Great work!

@martindevans martindevans merged commit ccc49eb into SciSharp:master Apr 23, 2024
3 checks passed
@martindevans martindevans deleted the batched_executor_save_single_conversation branch April 23, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants