aboutsummaryrefslogtreecommitdiff
path: root/examples/common.cpp
diff options
context:
space:
mode:
author44670 <44670@users.noreply.github.com>2023-05-04 23:41:12 +0800
committerGitHub <noreply@github.com>2023-05-04 18:41:12 +0300
commit2edbdb0f99336cb41f0995061c7602ed54beb863 (patch)
tree07ab5cb105543166c1ddc50864ba04d8d4e06f30 /examples/common.cpp
parent20fbf2a2a08d8edefe9b3435fa86f8b2f63f8588 (diff)
main : add --in-suffix option (#1318)
* adding --in-suffix option * print input suffix before generation
Diffstat (limited to 'examples/common.cpp')
-rw-r--r--examples/common.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/common.cpp b/examples/common.cpp
index cd63000..97eded6 100644
--- a/examples/common.cpp
+++ b/examples/common.cpp
@@ -324,6 +324,12 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
break;
}
params.input_prefix = argv[i];
+ } else if (arg == "--in-suffix") {
+ if (++i >= argc) {
+ invalid_param = true;
+ break;
+ }
+ params.input_suffix = argv[i];
} else {
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
gpt_print_usage(argc, argv, default_params);
@@ -362,6 +368,7 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
fprintf(stderr, " --session FNAME file to cache model state in (may be large!) (default: none)\n");
fprintf(stderr, " --random-prompt start with a randomized prompt.\n");
fprintf(stderr, " --in-prefix STRING string to prefix user inputs with (default: empty)\n");
+ fprintf(stderr, " --in-suffix STRING string to suffix after user inputs with (default: empty)\n");
fprintf(stderr, " -f FNAME, --file FNAME\n");
fprintf(stderr, " prompt file to start generation.\n");
fprintf(stderr, " -n N, --n_predict N number of tokens to predict (default: %d, -1 = infinity)\n", params.n_predict);