-
Notifications
You must be signed in to change notification settings - Fork 13.7k
memory: Hybrid context shift #17009
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
memory: Hybrid context shift #17009
Changes from 2 commits
4fb572c
24aff7f
3b59021
b8f9c56
104d8ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -354,7 +354,10 @@ int main(int argc, char ** argv) { | |
| } | ||
|
|
||
| // remove any "future" tokens that we might have inherited from the previous session | ||
| llama_memory_seq_rm(mem, -1, n_matching_session_tokens, -1); | ||
| if (!llama_memory_seq_rm(mem, -1, n_matching_session_tokens, -1)) { | ||
| LOG_INF("%s: unable to resuse common prefix\n", __func__); | ||
| llama_memory_seq_rm(mem, -1, -1, -1); | ||
|
Comment on lines
357
to
360
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if this will correctly trigger reevaluation of the context afterwards.
But I think there might be something else necessary here. (For example, should (This is mostly relevant when reloading a saved session, and not necessarily during context shifting, though)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, yeah, I'm still a little murky on the logic going on here. I'll look more carefully and see what I can find. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry folks,
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we're holding on this until I resolve the question in this thread. I'll try to get to that today!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I see what you're getting at here with the clause below that recalculates the cached logits for the final token. I think the right thing to do here is to set |
||
| } | ||
| } | ||
|
|
||
| LOG_DBG("recalculate the cached logits (check): embd_inp.size() %zu, n_matching_session_tokens %zu, embd_inp.size() %zu, session_tokens.size() %zu\n", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.