From 855ede74362c63e53f28216641ca75db9f871591 Mon Sep 17 00:00:00 2001 From: KerfuffleV2 Date: Sun, 11 Jun 2023 08:17:25 -0600 Subject: [PATCH] Add a comment clarifying where n_ctx - 4 came from --- examples/main/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 7591b2d14..66d563143 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -334,6 +334,8 @@ int main(int argc, char ** argv) { while ((n_remain != 0 && !is_antiprompt) || params.interactive) { // predict if (embd.size() > 0) { + // Note: n_ctx - 4 here is to match the logic for commandline prompt handling via + // --prompt or --file which uses the same value. auto max_embd_size = n_ctx - 4; // Ensure the input doesn't exceed the context size by truncating embd if necessary. if ((int)embd.size() > max_embd_size) {