72b12c3be7
This requires an upstream change to support graceful termination, carried as a patch.
30 lines
1.5 KiB
Diff
30 lines
1.5 KiB
Diff
diff --git a/examples/server/server.cpp b/examples/server/server.cpp
|
|
index a48582ad..9fffffd8 100644
|
|
--- a/examples/server/server.cpp
|
|
+++ b/examples/server/server.cpp
|
|
@@ -1564,12 +1564,6 @@ 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);
|
|
}
|
|
|
|
- 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);
|
|
-
|
|
- 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.
|
|
@@ -1581,6 +1575,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);
|
|
+
|
|
+ slot.cache_tokens = prompt_tokens;
|
|
+
|
|
LOG_VERBOSE("prompt ingested", {
|
|
{"n_past", slot.n_past},
|
|
{"cached", tokens_to_str(ctx, slot.cache_tokens.cbegin(), slot.cache_tokens.cbegin() + slot.n_past)},
|