Distribute and run LLMs with a single file.
C++ cross-platformggufllama-cpplocal-ailocal-inferencelocal-llmopen-source-aisingle-file-executablespeech-to-text
Introduce --silent-prompt flag to main
Justine Tunney28d3160145e7
diff --git a/llama.cpp/README.llamafile b/llama.cpp/README.llamafileindex a0e57f01..d97f2548 100644--- a/llama.cpp/README.llamafile+++ b/llama.cpp/README.llamafile@@ -34,3 +34,4 @@ LOCAL MODIFICATIONS- Remove log callback pointer API from Metal GPU module- Use runtime dispatching for matmul quants- Remove operating system #ifdef statements+ - Introduce --silent-prompt flag to maindiff --git a/llama.cpp/common.cpp b/llama.cpp/common.cppindex 74592344..ffcddcfa 100644--- a/llama.cpp/common.cpp+++ b/llama.cpp/common.cpp@@ -567,6 +567,8 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) {params.numa = true;} else if (arg == "--verbose-prompt") {params.verbose_prompt = true;+ } else if (arg == "--silent-prompt") {+ params.silent_prompt = true;} else if (arg == "-r" || arg == "--reverse-prompt") {if (++i >= argc) {invalid_param = true;diff --git a/llama.cpp/common.h b/llama.cpp/common.hindex e9e1093f..874fcbdc 100644--- a/llama.cpp/common.h+++ b/llama.cpp/common.h@@ -119,6 +119,7 @@ struct gpt_params {bool use_mlock = false; // use mlock to keep model in memorybool numa = false; // attempt optimizations that help on some NUMA systemsbool verbose_prompt = false; // print prompt tokens before generation+ bool silent_prompt = false; // don't print prompt to stdoutbool infill = false; // use infill modebool unsecure = false; // disable pledge() sandboxingdiff --git a/llama.cpp/main/main.cc b/llama.cpp/main/main.ccindex f3760935..1a332119 100644--- a/llama.cpp/main/main.cc+++ b/llama.cpp/main/main.cc@@ -466,7 +466,7 @@ int main(int argc, char ** argv) {}bool is_antiprompt = false;- bool input_echo = true;+ bool input_echo = !params.silent_prompt;bool need_to_save_session = !path_session.empty() && n_matching_session_tokens < embd_inp.size();int n_past = 0;@@ -735,6 +735,11 @@ int main(int argc, char ** argv) {printf("\n");} else if (params.instruct) {is_interacting = true;+ } else if (params.silent_prompt) {+ // --silent-prompt usually goes with `./main 2>/dev/null` and+ // doing that usually causes the llm terminal output to not+ // include a trailing newline. that's an unpleasant ux.+ printf("\n");}}