@@ -694,6 +694,12 @@ static bool is_autoy(const std::string & value) {
694694}
695695
696696common_params_context common_params_parser_init (common_params & params, llama_example ex, void (*print_usage)(int , char **)) {
697+ // default values specific to example
698+ // note: we place it here instead of inside server.cpp to allow llama-gen-docs to pick it up
699+ if (ex == LLAMA_EXAMPLE_SERVER ) {
700+ params.use_jinja = true ;
701+ }
702+
697703 // load dynamic backends
698704 ggml_backend_load_all ();
699705
@@ -974,7 +980,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
974980 [](common_params & params) {
975981 params.kv_unified = true ;
976982 }
977- ).set_env (" LLAMA_ARG_KV_SPLIT " ));
983+ ).set_env (" LLAMA_ARG_KV_UNIFIED " ));
978984 add_opt (common_arg (
979985 {" --no-context-shift" },
980986 string_format (" disables context shift on infinite text generation (default: %s)" , params.ctx_shift ? " disabled" : " enabled" ),
@@ -1232,6 +1238,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
12321238 [](common_params & params, const std::string & value) {
12331239 const auto sampler_names = string_split<std::string>(value, ' ;' );
12341240 params.sampling .samplers = common_sampler_types_from_names (sampler_names, true );
1241+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_SAMPLERS ;
12351242 }
12361243 ).set_sparam ());
12371244 add_opt (common_arg (
@@ -1261,27 +1268,31 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
12611268 [](common_params & params, const std::string & value) {
12621269 params.sampling .temp = std::stof (value);
12631270 params.sampling .temp = std::max (params.sampling .temp , 0 .0f );
1271+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_TEMP ;
12641272 }
12651273 ).set_sparam ());
12661274 add_opt (common_arg (
12671275 {" --top-k" }, " N" ,
12681276 string_format (" top-k sampling (default: %d, 0 = disabled)" , params.sampling .top_k ),
12691277 [](common_params & params, int value) {
12701278 params.sampling .top_k = value;
1279+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_TOP_K ;
12711280 }
12721281 ).set_sparam ());
12731282 add_opt (common_arg (
12741283 {" --top-p" }, " N" ,
12751284 string_format (" top-p sampling (default: %.1f, 1.0 = disabled)" , (double )params.sampling .top_p ),
12761285 [](common_params & params, const std::string & value) {
12771286 params.sampling .top_p = std::stof (value);
1287+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_TOP_P ;
12781288 }
12791289 ).set_sparam ());
12801290 add_opt (common_arg (
12811291 {" --min-p" }, " N" ,
12821292 string_format (" min-p sampling (default: %.1f, 0.0 = disabled)" , (double )params.sampling .min_p ),
12831293 [](common_params & params, const std::string & value) {
12841294 params.sampling .min_p = std::stof (value);
1295+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_MIN_P ;
12851296 }
12861297 ).set_sparam ());
12871298 add_opt (common_arg (
@@ -1296,13 +1307,15 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
12961307 string_format (" xtc probability (default: %.1f, 0.0 = disabled)" , (double )params.sampling .xtc_probability ),
12971308 [](common_params & params, const std::string & value) {
12981309 params.sampling .xtc_probability = std::stof (value);
1310+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_XTC_PROBABILITY ;
12991311 }
13001312 ).set_sparam ());
13011313 add_opt (common_arg (
13021314 {" --xtc-threshold" }, " N" ,
13031315 string_format (" xtc threshold (default: %.1f, 1.0 = disabled)" , (double )params.sampling .xtc_threshold ),
13041316 [](common_params & params, const std::string & value) {
13051317 params.sampling .xtc_threshold = std::stof (value);
1318+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_XTC_THRESHOLD ;
13061319 }
13071320 ).set_sparam ());
13081321 add_opt (common_arg (
@@ -1321,13 +1334,15 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
13211334 }
13221335 params.sampling .penalty_last_n = value;
13231336 params.sampling .n_prev = std::max (params.sampling .n_prev , params.sampling .penalty_last_n );
1337+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_PENALTY_LAST_N ;
13241338 }
13251339 ).set_sparam ());
13261340 add_opt (common_arg (
13271341 {" --repeat-penalty" }, " N" ,
13281342 string_format (" penalize repeat sequence of tokens (default: %.1f, 1.0 = disabled)" , (double )params.sampling .penalty_repeat ),
13291343 [](common_params & params, const std::string & value) {
13301344 params.sampling .penalty_repeat = std::stof (value);
1345+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_PENALTY_REPEAT ;
13311346 }
13321347 ).set_sparam ());
13331348 add_opt (common_arg (
@@ -1425,20 +1440,23 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
14251440 " (default: %d, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)" , params.sampling .mirostat ),
14261441 [](common_params & params, int value) {
14271442 params.sampling .mirostat = value;
1443+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_MIROSTAT ;
14281444 }
14291445 ).set_sparam ());
14301446 add_opt (common_arg (
14311447 {" --mirostat-lr" }, " N" ,
14321448 string_format (" Mirostat learning rate, parameter eta (default: %.1f)" , (double )params.sampling .mirostat_eta ),
14331449 [](common_params & params, const std::string & value) {
14341450 params.sampling .mirostat_eta = std::stof (value);
1451+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_MIROSTAT_ETA ;
14351452 }
14361453 ).set_sparam ());
14371454 add_opt (common_arg (
14381455 {" --mirostat-ent" }, " N" ,
14391456 string_format (" Mirostat target entropy, parameter tau (default: %.1f)" , (double )params.sampling .mirostat_tau ),
14401457 [](common_params & params, const std::string & value) {
14411458 params.sampling .mirostat_tau = std::stof (value);
1459+ params.sampling .user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_MIROSTAT_TAU ;
14421460 }
14431461 ).set_sparam ());
14441462 add_opt (common_arg (
@@ -2476,11 +2494,18 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
24762494 ).set_examples ({LLAMA_EXAMPLE_SERVER }));
24772495 add_opt (common_arg (
24782496 {" --jinja" },
2479- " use jinja template for chat (default: disabled) " ,
2497+ string_format ( " use jinja template for chat (default: %s) \n " , params. use_jinja ? " enabled " : " disabled " ) ,
24802498 [](common_params & params) {
24812499 params.use_jinja = true ;
24822500 }
24832501 ).set_examples ({LLAMA_EXAMPLE_SERVER , LLAMA_EXAMPLE_MAIN , LLAMA_EXAMPLE_MTMD }).set_env (" LLAMA_ARG_JINJA" ));
2502+ add_opt (common_arg (
2503+ {" --no-jinja" },
2504+ string_format (" disable jinja template for chat (default: %s)\n " , params.use_jinja ? " enabled" : " disabled" ),
2505+ [](common_params & params) {
2506+ params.use_jinja = false ;
2507+ }
2508+ ).set_examples ({LLAMA_EXAMPLE_SERVER , LLAMA_EXAMPLE_MAIN , LLAMA_EXAMPLE_MTMD }).set_env (" LLAMA_ARG_NO_JINJA" ));
24842509 add_opt (common_arg (
24852510 {" --reasoning-format" }, " FORMAT" ,
24862511 " controls whether thought tags are allowed and/or extracted from the response, and in which format they're returned; one of:\n "
@@ -2614,7 +2639,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
26142639 [](common_params &, const std::string & value) {
26152640 common_log_set_file (common_log_main (), value.c_str ());
26162641 }
2617- ));
2642+ ). set_env ( " LLAMA_LOG_FILE " ) );
26182643 add_opt (common_arg (
26192644 {" --log-colors" }, " [on|off|auto]" ,
26202645 " Set colored logging ('on', 'off', or 'auto', default: 'auto')\n "
0 commit comments