summaryrefslogtreecommitdiff
path: root/examples/main
diff options
context:
space:
mode:
authorGeorgi Gerganov <ggerganov@gmail.com>2023-10-03 21:04:01 +0300
committerGitHub <noreply@github.com>2023-10-03 21:04:01 +0300
commitac2219fef34eb5b713c286c34c6e4162c39c8f3b (patch)
tree00d1bdad46d4995188ff084ae6178b9ff55f7431 /examples/main
parent48be797ffbd80b062f55778e09e97180eb25d2ab (diff)
llama : fix session saving/loading (#3400)
* llama : fix session saving/loading * llama : temp fix for clearing "future" tokens from the KV cache * llama : fix handling of "future" tokens when loading sessions * llama : fix comments for llama_kv_cache API
Diffstat (limited to 'examples/main')
-rw-r--r--examples/main/main.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index 3a4ed3f7..7367ae36 100644
--- a/examples/main/main.cpp
+++ b/examples/main/main.cpp
@@ -543,6 +543,9 @@ int main(int argc, char ** argv) {
if (i > 0) {
embd.erase(embd.begin(), embd.begin() + i);
}
+
+ // remove any "future" tokens that we might have inherited from the session from the KV cache
+ llama_kv_cache_tokens_rm(ctx, n_past, -1);
}
// evaluate tokens in batches