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
server: avoid breaking KV cache when prompt >= n_ctx #6958
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on static code analysis I think the code works. I have comparatively little experience with the server so it would be useful if someone else were to also check. Also it would be good to have an automated test for context shifting but I don't know how we could write one.
Slight nitpick: I personally prefer explicit bool <-> int conversions.
Yeah, writing a test for shifting itself is a bit tricky, but not for the truncation feature.
|
This is the simplest solution to #6855, split truncate flag between
shifted
when the KV cache is shifted during inference andtruncated
when it happens before inference. Introducen_truncate
flag to shift both prompt and cached tokens when the prompt > n_ctx. Needs testing.