summaryrefslogtreecommitdiff
path: root/llama.cpp_silent_prompt.patch
blob: 71b6ad8a307b700dcd81f45e3cf8a5d90a0024da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
commit 90b0d35e400a078545401840f78c0bf02207864d
Author: tslil clingman <>
Date:   Sun Dec 31 18:50:17 2023 +0100

    add --silent-prompt

diff --git a/common/common.cpp b/common/common.cpp
index eacaee1..f939b50 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -592,6 +592,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/common/common.h b/common/common.h
index 9659aa0..01c68fa 100644
--- a/common/common.h
+++ b/common/common.h
@@ -122,6 +122,7 @@ struct gpt_params {
     bool use_mlock         = false; // use mlock to keep model in memory
     bool numa              = false; // attempt optimizations that help on some NUMA systems
     bool verbose_prompt    = false; // print prompt tokens before generation
+    bool silent_prompt     = false; // don't print prompt to stdout
     bool infill            = false; // use infill mode
     bool dump_kv_cache     = false; // dump the KV cache contents for debugging purposes
     bool no_kv_offload     = false; // disable KV offloading
@@ -240,4 +241,3 @@ void dump_kv_cache_view(const llama_kv_cache_view & view, int row_size = 80);
 
 // Dump the KV cache view showing individual sequences in each cell (long output).
 void dump_kv_cache_view_seqs(const llama_kv_cache_view & view, int row_size = 40);
-
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index c096f11..8676ab4 100644
--- a/examples/main/main.cpp
+++ b/examples/main/main.cpp
@@ -461,7 +461,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;