Skip to content

fix instruct mode #445

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ int main(int argc, char ** argv) {
}

// replace end of text token with newline token when in interactive mode
if (id == llama_token_eos() && params.interactive) {
if (id == llama_token_eos() && params.interactive && !params.instruct) {
id = llama_token_newline.front();
if (params.antiprompt.size() != 0) {
// tokenize and inject first reverse prompt
Expand Down Expand Up @@ -464,8 +464,12 @@ int main(int argc, char ** argv) {

// end of text token
if (embd.back() == llama_token_eos()) {
fprintf(stderr, " [end of text]\n");
break;
if (params.instruct) {
is_interacting = true;
} else {
fprintf(stderr, " [end of text]\n");
break;
}
}

// In interactive mode, respect the maximum number of tokens and drop back to user input when reached.
Expand Down