| 1004 | } |
| 1005 | |
| 1006 | static void common_params_print_usage(common_params_context & ctx_arg) { |
| 1007 | auto print_options = [](std::vector<common_arg *> & options) { |
| 1008 | for (common_arg * opt : options) { |
| 1009 | printf("%s", opt->to_string().c_str()); |
| 1010 | } |
| 1011 | }; |
| 1012 | |
| 1013 | std::vector<common_arg *> common_options; |
| 1014 | std::vector<common_arg *> sparam_options; |
| 1015 | std::vector<common_arg *> specific_options; |
| 1016 | for (auto & opt : ctx_arg.options) { |
| 1017 | // in case multiple LLAMA_EXAMPLE_* are set, we prioritize the LLAMA_EXAMPLE_* matching current example |
| 1018 | if (opt.is_sparam) { |
| 1019 | sparam_options.push_back(&opt); |
| 1020 | } else if (opt.in_example(ctx_arg.ex)) { |
| 1021 | specific_options.push_back(&opt); |
| 1022 | } else { |
| 1023 | common_options.push_back(&opt); |
| 1024 | } |
| 1025 | } |
| 1026 | printf("----- common params -----\n\n"); |
| 1027 | print_options(common_options); |
| 1028 | printf("\n\n----- sampling params -----\n\n"); |
| 1029 | print_options(sparam_options); |
| 1030 | // TODO: maybe convert enum llama_example to string |
| 1031 | printf("\n\n----- example-specific params -----\n\n"); |
| 1032 | print_options(specific_options); |
| 1033 | } |
| 1034 | |
| 1035 | static void common_params_print_completion(common_params_context & ctx_arg) { |
| 1036 | std::vector<common_arg *> common_options; |
no test coverage detected