Skip to content

Commit db94854

Browse files
aldehirggerganov
andauthored
server : skip checkpoints beyond pos_next (ggml-org#24411)
* server : skip checkpoints beyond pos_next * cont : update comment + TODO + ref --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
1 parent ac4cdde commit db94854

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tools/server/server-context.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,6 +2046,9 @@ struct server_context_impl {
20462046

20472047
auto & cur = slot.prompt.checkpoints.emplace_back();
20482048

2049+
// [TAG_CHECKPOINTS_FIX_POS_MIN]
2050+
// TODO: here we incorrectly deterimne that the saved checkpoint data covers the [pos_min, pos_max] range
2051+
// this is not true for SWA models: https://github.com/ggml-org/llama.cpp/pull/24411#issuecomment-4677983225
20492052
cur.update_pos(slot.prompt.n_tokens() - n_tokens_cur, pos_min, pos_max);
20502053

20512054
cur.update_tgt(ctx_tgt, slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY);
@@ -2860,6 +2863,10 @@ struct server_context_impl {
28602863
// guarantee that a checkpoint will result in at least one token being processed [TAG_PROMPT_LOGITS]
28612864
LOG_INF("slot %12.*s: id %2d | task %d | Checking checkpoint with [%d, %d] against %d...\n", 12,
28622865
func_name, (slot).id, ((slot).task ? (slot).task->id : -1), cur.pos_min, cur.pos_max, pos_min_thold);
2866+
// workaround for [TAG_CHECKPOINTS_FIX_POS_MIN]
2867+
if (cur.pos_max > pos_next) {
2868+
return false;
2869+
}
28632870
return cur.pos_min < pos_min_thold || cur.pos_min == 0;
28642871
}
28652872
);

0 commit comments

Comments
 (0)