From 590af480abb3a141798ff1ba75c21b4dff2d5380 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 10 Feb 2024 20:49:21 +0800 Subject: [PATCH] contextshift more forgiving --- gpttype_adapter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpttype_adapter.cpp b/gpttype_adapter.cpp index b13cf6449..eadbbc95d 100644 --- a/gpttype_adapter.cpp +++ b/gpttype_adapter.cpp @@ -621,7 +621,7 @@ void PurgeMissingTokens(llama_context * ctx, std::vector ¤t_context_t //remove all tokens from old ctx between p0 and p1, updating both arrays and kv, then continue as normal const int ShortfallThreshold = 200 + (nctx/20); //dont trigger shifting if the distance between trimstart and currhead < this - const int SlackAllowance = 50 + (nctx/60); //in case the end text is slightly modified, be forgiving + const int SlackAllowance = 50 + (nctx/50); //in case the end text is slightly modified, be forgiving int trimstart = 0; int new_tokens_len = new_context_tokens.size(); @@ -650,7 +650,7 @@ void PurgeMissingTokens(llama_context * ctx, std::vector ¤t_context_t } //at least this many tokens need to match, otherwise don't bother trimming - const int LCSTokThreshold = std::max(std::min((new_tokens_len - trimstart) - (genamt+SlackAllowance), (int)(nctx*0.55)), ShortfallThreshold-SlackAllowance); + const int LCSTokThreshold = std::max(std::min((new_tokens_len - trimstart) - (genamt+SlackAllowance), (int)(nctx*0.5)), ShortfallThreshold-SlackAllowance); auto curr_ctx_without_memory = std::vector(current_context_tokens.begin() + trimstart, current_context_tokens.end()); auto new_ctx_without_memory = std::vector(new_context_tokens.begin() + trimstart, new_context_tokens.end());