Correction to 4a37251a - since we did not insert the bos token, do not need attempt to rescue it during context swap

This commit is contained in:
Jan Ploski 2023-06-16 19:53:38 +02:00
parent 4a37251a18
commit 3d6ed18542

View File

@ -359,9 +359,6 @@ int main(int argc, char ** argv) {
if (n_past + (int) embd.size() > n_ctx) { if (n_past + (int) embd.size() > n_ctx) {
const int n_left = n_past - params.n_keep; const int n_left = n_past - params.n_keep;
// always keep the first token - BOS
n_past = std::max(1, params.n_keep);
// insert n_left/2 tokens at the start of embd from last_n_tokens // insert n_left/2 tokens at the start of embd from last_n_tokens
embd.insert(embd.begin(), last_n_tokens.begin() + n_ctx - n_left/2 - embd.size(), last_n_tokens.end() - embd.size()); embd.insert(embd.begin(), last_n_tokens.begin() + n_ctx - n_left/2 - embd.size(), last_n_tokens.end() - embd.size());