Strip trailing whitespace from prompt file
Many/most text editors save with trailing whitespace.
This commit is contained in:
parent
a169bb889c
commit
9ec1dfdbe2
1 changed files with 6 additions and 2 deletions
|
@ -33,6 +33,10 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
|
||||||
std::istreambuf_iterator<char>(),
|
std::istreambuf_iterator<char>(),
|
||||||
back_inserter(params.prompt));
|
back_inserter(params.prompt));
|
||||||
|
|
||||||
|
std::string& p = params.prompt;
|
||||||
|
p.erase(std::find_if(p.rbegin(), p.rend(), [](unsigned char ch) {
|
||||||
|
return !std::isspace(ch);
|
||||||
|
}).base(), p.end());
|
||||||
} 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…
Add table
Add a link
Reference in a new issue