Skip to content

Commit

Permalink
Drop trailing new line from file prompts (abetlen#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Mar 19, 2023
1 parent a4e63b7 commit 70f01cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ int main(int argc, char ** argv) {

// in instruct mode, we inject a prefix and a suffix to each input by the user
if (params.instruct) {
fprintf(stderr, "== Instruction mode enabled ==\n");
params.interactive = true;
params.antiprompt = "### Instruction:\n\n";
}
Expand Down
3 changes: 3 additions & 0 deletions utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
} else if (arg == "-f" || arg == "--file") {
std::ifstream file(argv[++i]);
std::copy(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>(), back_inserter(params.prompt));
if (params.prompt.back() == '\n') {
params.prompt.pop_back();
}
} else if (arg == "-n" || arg == "--n_predict") {
params.n_predict = std::stoi(argv[++i]);
} else if (arg == "--top_k") {
Expand Down

0 comments on commit 70f01cb

Please sign in to comment.