From 2479c78bc6fd8355580b551bff55fffb44e882d9 Mon Sep 17 00:00:00 2001 From: rabidcopy Date: Mon, 20 Mar 2023 17:45:52 -0500 Subject: [PATCH] alternate approach to replace end of text tokens --- main.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index 7db8de928..5461c9e84 100644 --- a/main.cpp +++ b/main.cpp @@ -1001,6 +1001,12 @@ int main(int argc, char ** argv) { t_sample_us += ggml_time_us() - t_start_sample_us; } + // replace end of text token with newline token when in interactive mode + if (id == EOS_TOKEN_ID && params.interactive) { + id = NEWLINE_TOKEN_ID; + is_interacting = true; + } + // add it to the context embd.push_back(id); @@ -1086,12 +1092,12 @@ int main(int argc, char ** argv) { // end of text token if (embd.back() == EOS_TOKEN_ID) { if (params.interactive) { - is_interacting = true; - embd.back() = NEWLINE_TOKEN_ID; - last_n_tokens.back() = NEWLINE_TOKEN_ID; - if (params.antiprompt.size() != 0) { - fprintf(stderr, "\n"); - } +// is_interacting = true; +// embd.back() = NEWLINE_TOKEN_ID; +// last_n_tokens.back() = NEWLINE_TOKEN_ID; +// if (params.antiprompt.size() != 0) { +// fprintf(stderr, "\n"); +// } } else { fprintf(stderr, " [end of text]\n"); break;