| 641 | } |
| 642 | |
| 643 | static void common_params_print_usage(common_params_context & ctx_arg) { |
| 644 | auto print_options = [](std::vector<common_arg *> & options) { |
| 645 | for (common_arg * opt : options) { |
| 646 | printf("%s", opt->to_string().c_str()); |
| 647 | } |
| 648 | }; |
| 649 | |
| 650 | std::vector<common_arg *> common_options; |
| 651 | std::vector<common_arg *> sparam_options; |
| 652 | std::vector<common_arg *> specific_options; |
| 653 | for (auto & opt : ctx_arg.options) { |
| 654 | // in case multiple LLAMA_EXAMPLE_* are set, we prioritize the LLAMA_EXAMPLE_* matching current example |
| 655 | if (opt.is_sparam) { |
| 656 | sparam_options.push_back(&opt); |
| 657 | } else if (opt.in_example(ctx_arg.ex)) { |
| 658 | specific_options.push_back(&opt); |
| 659 | } else { |
| 660 | common_options.push_back(&opt); |
| 661 | } |
| 662 | } |
| 663 | printf("----- common params -----\n\n"); |
| 664 | print_options(common_options); |
| 665 | printf("\n\n----- sampling params -----\n\n"); |
| 666 | print_options(sparam_options); |
| 667 | // TODO: maybe convert enum llama_example to string |
| 668 | printf("\n\n----- example-specific params -----\n\n"); |
| 669 | print_options(specific_options); |
| 670 | } |
| 671 | |
| 672 | static void common_params_print_completion(common_params_context & ctx_arg) { |
| 673 | std::vector<common_arg *> common_options; |
no test coverage detected