diff options
author | Murilo Santana <mvrilo@gmail.com> | 2023-04-01 23:41:12 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-02 04:41:12 +0200 |
commit | 5b70e7de4c0b8186669d0c5609ba61a2d46de562 (patch) | |
tree | 463b74fd82ebd99a267d46d39b9cb8225231eea7 | |
parent | a717cba8440b380f43cd3e2510862fc1ea3de9a2 (diff) |
fix default params for examples/main (#697)
-rw-r--r-- | examples/common.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/common.cpp b/examples/common.cpp index 50c5365..5400f6b 100644 --- a/examples/common.cpp +++ b/examples/common.cpp @@ -39,6 +39,8 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) { bool invalid_param = false; std::string arg; + gpt_params default_params; + for (int i = 1; i < argc; i++) { arg = argv[i]; @@ -173,7 +175,7 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) { } params.n_parts = std::stoi(argv[i]); } else if (arg == "-h" || arg == "--help") { - gpt_print_usage(argc, argv, params); + gpt_print_usage(argc, argv, default_params); exit(0); } else if (arg == "--random-prompt") { params.random_prompt = true; @@ -185,13 +187,13 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) { params.input_prefix = argv[i]; } else { fprintf(stderr, "error: unknown argument: %s\n", arg.c_str()); - gpt_print_usage(argc, argv, params); + gpt_print_usage(argc, argv, default_params); exit(1); } } if (invalid_param) { fprintf(stderr, "error: invalid parameter for argument: %s\n", arg.c_str()); - gpt_print_usage(argc, argv, params); + gpt_print_usage(argc, argv, default_params); exit(1); } |