summaryrefslogtreecommitdiff
path: root/examples/main/main.cpp
diff options
context:
space:
mode:
authorGeorgi Gerganov <ggerganov@gmail.com>2023-10-11 23:55:08 +0300
committerGeorgi Gerganov <ggerganov@gmail.com>2023-10-11 23:55:41 +0300
commitb8fe4b5cc9cb237ca98e5bc51b5d189e3c446d13 (patch)
treeb606053e5a038daeda9d90dfa510db715bddec36 /examples/main/main.cpp
parenta8bdd65525ae86dea905e9866ad369b53e30ac14 (diff)
main : fix session loading bug (#3400)
Diffstat (limited to 'examples/main/main.cpp')
-rw-r--r--examples/main/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index b39a67d9..55f73356 100644
--- a/examples/main/main.cpp
+++ b/examples/main/main.cpp
@@ -297,6 +297,9 @@ int main(int argc, char ** argv) {
LOG_TEE("%s: session file matches %zu / %zu tokens of prompt\n",
__func__, n_matching_session_tokens, embd_inp.size());
}
+
+ // remove any "future" tokens that we might have inherited from the previous session
+ llama_kv_cache_tokens_rm(ctx, n_matching_session_tokens, -1);
}
LOGLN(
@@ -545,9 +548,6 @@ 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