fix off-by-one npast during some instances of fast forwarding

This commit is contained in:
Concedo 2025-05-22 19:51:21 +08:00
parent f10574e598
commit f125e724eb
3 changed files with 11 additions and 3 deletions

View file

@ -464,9 +464,10 @@ void print_tok_vec(std::vector<float> &embd)
//fast forward the past based on identical tokens, stop once a divergence is noted
int embd_inp_len = embd_inp.size();
int cur_ctx_len = current_context_tokens.size();
bool fastforwardok = true;
for (int i = 0; i < current_context_tokens.size(); ++i)
for (int i = 0; i < cur_ctx_len; ++i)
{
if (current_context_tokens[i] == embd_inp[i])
{
@ -500,6 +501,10 @@ void print_tok_vec(std::vector<float> &embd)
{
break;
}
if ((i + 2) >= cur_ctx_len)
{
break;
}
}
}