Skip to content

Commit

Permalink
main : fix session loading bug (#3400)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Oct 11, 2023
1 parent a8bdd65 commit b8fe4b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b8fe4b5

Please sign in to comment.