main : restore old EOS behavior in interactive mode

This commit is contained in:
Georgi Gerganov 2023-08-21 15:40:51 +03:00
parent dadbed99e6
commit 8af1991e2a
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -634,6 +634,11 @@ int main(int argc, char ** argv) {
llama_grammar_accept_token(ctx, grammar, id);
}
// replace end of text token with newline token when in interactive mode
if (id == llama_token_eos() && params.interactive && !params.instruct && !params.input_prefix_bos) {
id = llama_token_nl();
}
last_n_tokens.erase(last_n_tokens.begin());
last_n_tokens.push_back(id);
}