This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
Reserve more eval memory and use ggml scratch buffers #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This attempts to fix #115
Not the brightest of code. Scratch buffer usage is imitated from llama.cpp.
evaluate
context memory reservation is also imitated there (or at least that's the attempt). Note that I didn't actually go through all the things in llama.cpp, only the ones related to context memory size, so I might be missing something.I'm quite sure this allocates a lot more extra memory for 7B and 13B models as well, even though I never had any issues with them running out of context memory. Scratch buffers take 1GB, and that's for every
InferenceSession
.Maybe it would make sense to only use scratch buffers for inferring bigger models only? Though I think llama.cpp uses them always. Also, if there are multiple sessions, scratch memory buffers are not shared between them, but they could (just make sure only run one
evaluate
at a time somehow).Anyway, with these changes I couldn't manage to run out of context memory any more, even with 65B model.