MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / common_params_parser_init

Function common_params_parser_init

common/arg.cpp:989–3917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

987}
988
989common_params_context common_params_parser_init(common_params & params, llama_example ex, void(*print_usage)(int, char **)) {
990 // per-example default params
991 // we define here to make sure it's included in llama-gen-docs
992 if (ex == LLAMA_EXAMPLE_COMPLETION) {
993 params.use_jinja = false; // disable jinja by default
994
995 } else if (ex == LLAMA_EXAMPLE_MTMD) {
996 params.use_jinja = false; // disable jinja by default
997 params.sampling.temp = 0.2; // lower temp by default for better quality
998
999 } else if (ex == LLAMA_EXAMPLE_SERVER) {
1000 params.n_parallel = -1; // auto by default
1001 }
1002
1003 params.use_color = tty_can_use_colors();
1004
1005 // load dynamic backends
1006 ggml_backend_load_all();
1007
1008 common_params_context ctx_arg(params);
1009 ctx_arg.print_usage = print_usage;
1010 ctx_arg.ex = ex;
1011
1012 std::string sampler_type_chars;
1013 std::string sampler_type_names;
1014 for (const auto & sampler : params.sampling.samplers) {
1015 sampler_type_chars += common_sampler_type_to_chr(sampler);
1016 sampler_type_names += common_sampler_type_to_str(sampler) + ";";
1017 }
1018 if (!sampler_type_names.empty()) {
1019 sampler_type_names.pop_back(); // remove last semicolon
1020 }
1021
1022
1023 /**
1024 * filter options by example
1025 * rules:
1026 * - all examples inherit options from LLAMA_EXAMPLE_COMMON
1027 * - if LLAMA_EXAMPLE_* is set (other than COMMON), we only show the option in the corresponding example
1028 * - if both {LLAMA_EXAMPLE_COMMON, LLAMA_EXAMPLE_*,} are set, we will prioritize the LLAMA_EXAMPLE_* matching current example
1029 */
1030 auto add_opt = [&](common_arg arg) {
1031 if ((arg.in_example(ex) || arg.in_example(LLAMA_EXAMPLE_COMMON)) && !arg.is_exclude(ex)) {
1032 ctx_arg.options.push_back(std::move(arg));
1033 }
1034 };
1035
1036
1037 add_opt(common_arg(
1038 {"-h", "--help", "--usage"},
1039 "print usage and exit",
1040 [](common_params & params) {
1041 params.usage = true;
1042 }
1043 ));
1044 add_opt(common_arg(
1045 {"--version"},
1046 "show version and build info",

Callers 6

mainFunction · 0.85
common_preset_contextMethod · 0.85
arg.cppFile · 0.85
common_params_to_mapFunction · 0.85
common_params_parseFunction · 0.85
write_helpFunction · 0.85

Calls 15

tty_can_use_colorsFunction · 0.85
ggml_backend_load_allFunction · 0.85
common_argClass · 0.85
parse_cpu_maskFunction · 0.85
parse_cpu_rangeFunction · 0.85
parse_csv_rowFunction · 0.85

Tested by 1

mainFunction · 0.68