]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Drop trailing new line from file prompts (#80)
authorGeorgi Gerganov <redacted>
Sun, 19 Mar 2023 17:04:44 +0000 (19:04 +0200)
committerGeorgi Gerganov <redacted>
Sun, 19 Mar 2023 17:05:04 +0000 (19:05 +0200)
main.cpp
utils.cpp

index a95e2e72151fc23c522d6511d4eb75d144242815..2a07bbb40f5ee8af388b94433aea05e80f2e769b 100644 (file)
--- a/main.cpp
+++ b/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
     if (params.instruct) {
-        fprintf(stderr, "== Instruction mode enabled ==\n");
         params.interactive = true;
         params.antiprompt = "### Instruction:\n\n";
     }
index be81c6cd08cfcdd10a43898eeb8d1e181f00cb06..320d7c31c52a27043f65ad128f5f480c99761497 100644 (file)
--- a/utils.cpp
+++ b/utils.cpp
@@ -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") {