diff options
author | l3utterfly <gc.pthzfoldr@gmail.com> | 2024-05-02 04:27:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 22:27:41 +0300 |
commit | 8d608a81b7bd170f700648f8214e6f3279d4d715 (patch) | |
tree | e8b1cb37f450fe28dbd9cc31f24dde191c82d8ce /examples/main/main.cpp | |
parent | 3ea0d36000e2314baba7e9fc6a97f08670a6f7e4 (diff) |
main : fix off by one error for context shift (#6921)
Diffstat (limited to 'examples/main/main.cpp')
-rw-r--r-- | examples/main/main.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 5c693657..eabbc2db 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -544,7 +544,7 @@ int main(int argc, char ** argv) { // if we run out of context: // - take the n_keep first tokens from the original prompt (via n_past) // - take half of the last (n_ctx - n_keep) tokens and recompute the logits in batches - if (n_past + (int) embd.size() + std::max<int>(0, guidance_offset) > n_ctx) { + if (n_past + (int) embd.size() + std::max<int>(0, guidance_offset) >= n_ctx) { if (params.n_predict == -2) { LOG_TEE("\n\n%s: context full and n_predict == -%d => stopping\n", __func__, params.n_predict); break; |