mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 22:08:46 +01:00
Drop trailing new line from file prompts (#80)
This commit is contained in:
parent
a4e63b73df
commit
70f01cb863
1
main.cpp
1
main.cpp
@ -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
|
// in instruct mode, we inject a prefix and a suffix to each input by the user
|
||||||
if (params.instruct) {
|
if (params.instruct) {
|
||||||
fprintf(stderr, "== Instruction mode enabled ==\n");
|
|
||||||
params.interactive = true;
|
params.interactive = true;
|
||||||
params.antiprompt = "### Instruction:\n\n";
|
params.antiprompt = "### Instruction:\n\n";
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
|
|||||||
} else if (arg == "-f" || arg == "--file") {
|
} else if (arg == "-f" || arg == "--file") {
|
||||||
std::ifstream file(argv[++i]);
|
std::ifstream file(argv[++i]);
|
||||||
std::copy(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>(), back_inserter(params.prompt));
|
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") {
|
} else if (arg == "-n" || arg == "--n_predict") {
|
||||||
params.n_predict = std::stoi(argv[++i]);
|
params.n_predict = std::stoi(argv[++i]);
|
||||||
} else if (arg == "--top_k") {
|
} else if (arg == "--top_k") {
|
||||||
|
Loading…
Reference in New Issue
Block a user