Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
26b13fc3
Unverified
Commit
26b13fc3
authored
Feb 12, 2024
by
Jeffrey Morgan
Committed by
GitHub
Feb 12, 2024
Browse files
patch: always add token to cache_tokens (#2459)
parent
1c8435ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
25 deletions
+16
-25
llm/patches/01-cache.diff
llm/patches/01-cache.diff
+16
-25
No files found.
llm/patches/01-cache.diff
View file @
26b13fc3
diff --git a/examples/server/server.cpp b/examples/server/server.cpp
diff --git a/examples/server/server.cpp b/examples/server/server.cpp
index d86d7e04..
7d71c766
100644
index d86d7e04..
2694e92e
100644
--- a/examples/server/server.cpp
--- a/examples/server/server.cpp
+++ b/examples/server/server.cpp
+++ b/examples/server/server.cpp
@@ -1598,12 +1598,6 @@
struct llama_server_context
@@ -901,13 +901,15 @@
struct llama_server_context
LOG_TEE("slot %d : in cache: %i tokens | to process: %i tokens\n", slot.id, slot.n_past, slot.num_prompt_tokens_processed);
slot.sent_count += result.text_to_send.size();
}
// add the token to slot queue and cache
}
- LOG_TEE("slot %d : kv cache rm - [%d, end)\n", slot.id, (int) system_tokens.size() + slot.n_past);
- slot.add_token_string(result);
-
- llama_kv_cache_seq_rm(ctx, slot.id, system_tokens.size() + slot.n_past, -1);
-
- slot.cache_tokens = prompt_tokens;
-
if (slot.n_past == slot.num_prompt_tokens && slot.n_past > 0)
{
// we have to evaluate at least 1 token to generate logits.
@@ -1615,6 +1609,12 @@
struct llama_server_context
}
}
+ LOG_TEE("slot %d : kv cache rm - [%d, end)\n", slot.id, (int) system_tokens.size() + slot.n_past);
+
+
+ llama_kv_cache_seq_rm(ctx, slot.id, system_tokens.size() + slot.n_past, -1);
if (slot.params.stream)
+
{
+ slot.cache_tokens = prompt_tokens;
send_partial_response(slot, result);
}
}
+ slot.add_token_string(result);
+
+
LOG_VERBOSE("prompt ingested", {
if (incomplete)
{"n_past", slot.n_past},
{
{"cached", tokens_to_str(ctx, slot.cache_tokens.cbegin(), slot.cache_tokens.cbegin() + slot.n_past)},
slot.has_next_token = true;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment