Skip to content

Commit 8af1991

Browse files
committed
main : restore old EOS behavior in interactive mode
1 parent dadbed9 commit 8af1991

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/main/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,11 @@ int main(int argc, char ** argv) {
634634
llama_grammar_accept_token(ctx, grammar, id);
635635
}
636636

637+
// replace end of text token with newline token when in interactive mode
638+
if (id == llama_token_eos() && params.interactive && !params.instruct && !params.input_prefix_bos) {
639+
id = llama_token_nl();
640+
}
641+
637642
last_n_tokens.erase(last_n_tokens.begin());
638643
last_n_tokens.push_back(id);
639644
}

0 commit comments

Comments
 (0)