Skip to content

Commit 16639ba

Browse files
authored
common : use two decimal places for float arg help messages (ggml-org#19048)
* common : use two decimal places for float arg help messages This commit updates the help messages for various command-line arguments in arg.cpp to display floating-point default values with two decimal places instead of one. The motivation for this changes is that currently only having one decimal place means that values generated using --help or llama-gen-docs will not display the correct values. For example, currently the value of top-p in tools/server/README.md is `0.9`, but the default value is actually '0.95'. And running llama-gen-docs does not update this value as it uses the output from the help message, which shows only one decimal place, so the values look like they are unchanged. * docs : run llama-gen-docs to update docs
1 parent 9981c30 commit 16639ba

4 files changed

Lines changed: 94 additions & 91 deletions

File tree

common/arg.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
15771577
).set_sparam());
15781578
add_opt(common_arg(
15791579
{"--temp"}, "N",
1580-
string_format("temperature (default: %.1f)", (double)params.sampling.temp),
1580+
string_format("temperature (default: %.2f)", (double)params.sampling.temp),
15811581
[](common_params & params, const std::string & value) {
15821582
params.sampling.temp = std::stof(value);
15831583
params.sampling.temp = std::max(params.sampling.temp, 0.0f);
@@ -1594,46 +1594,46 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
15941594
).set_sparam().set_env("LLAMA_ARG_TOP_K"));
15951595
add_opt(common_arg(
15961596
{"--top-p"}, "N",
1597-
string_format("top-p sampling (default: %.1f, 1.0 = disabled)", (double)params.sampling.top_p),
1597+
string_format("top-p sampling (default: %.2f, 1.0 = disabled)", (double)params.sampling.top_p),
15981598
[](common_params & params, const std::string & value) {
15991599
params.sampling.top_p = std::stof(value);
16001600
params.sampling.user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_TOP_P;
16011601
}
16021602
).set_sparam());
16031603
add_opt(common_arg(
16041604
{"--min-p"}, "N",
1605-
string_format("min-p sampling (default: %.1f, 0.0 = disabled)", (double)params.sampling.min_p),
1605+
string_format("min-p sampling (default: %.2f, 0.0 = disabled)", (double)params.sampling.min_p),
16061606
[](common_params & params, const std::string & value) {
16071607
params.sampling.min_p = std::stof(value);
16081608
params.sampling.user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_MIN_P;
16091609
}
16101610
).set_sparam());
16111611
add_opt(common_arg(
16121612
{"--top-nsigma"}, "N",
1613-
string_format("top-n-sigma sampling (default: %.1f, -1.0 = disabled)", params.sampling.top_n_sigma),
1613+
string_format("top-n-sigma sampling (default: %.2f, -1.0 = disabled)", params.sampling.top_n_sigma),
16141614
[](common_params & params, const std::string & value) {
16151615
params.sampling.top_n_sigma = std::stof(value);
16161616
}
16171617
).set_sparam());
16181618
add_opt(common_arg(
16191619
{"--xtc-probability"}, "N",
1620-
string_format("xtc probability (default: %.1f, 0.0 = disabled)", (double)params.sampling.xtc_probability),
1620+
string_format("xtc probability (default: %.2f, 0.0 = disabled)", (double)params.sampling.xtc_probability),
16211621
[](common_params & params, const std::string & value) {
16221622
params.sampling.xtc_probability = std::stof(value);
16231623
params.sampling.user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_XTC_PROBABILITY;
16241624
}
16251625
).set_sparam());
16261626
add_opt(common_arg(
16271627
{"--xtc-threshold"}, "N",
1628-
string_format("xtc threshold (default: %.1f, 1.0 = disabled)", (double)params.sampling.xtc_threshold),
1628+
string_format("xtc threshold (default: %.2f, 1.0 = disabled)", (double)params.sampling.xtc_threshold),
16291629
[](common_params & params, const std::string & value) {
16301630
params.sampling.xtc_threshold = std::stof(value);
16311631
params.sampling.user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_XTC_THRESHOLD;
16321632
}
16331633
).set_sparam());
16341634
add_opt(common_arg(
16351635
{"--typical"}, "N",
1636-
string_format("locally typical sampling, parameter p (default: %.1f, 1.0 = disabled)", (double)params.sampling.typ_p),
1636+
string_format("locally typical sampling, parameter p (default: %.2f, 1.0 = disabled)", (double)params.sampling.typ_p),
16371637
[](common_params & params, const std::string & value) {
16381638
params.sampling.typ_p = std::stof(value);
16391639
}
@@ -1652,29 +1652,29 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
16521652
).set_sparam());
16531653
add_opt(common_arg(
16541654
{"--repeat-penalty"}, "N",
1655-
string_format("penalize repeat sequence of tokens (default: %.1f, 1.0 = disabled)", (double)params.sampling.penalty_repeat),
1655+
string_format("penalize repeat sequence of tokens (default: %.2f, 1.0 = disabled)", (double)params.sampling.penalty_repeat),
16561656
[](common_params & params, const std::string & value) {
16571657
params.sampling.penalty_repeat = std::stof(value);
16581658
params.sampling.user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_PENALTY_REPEAT;
16591659
}
16601660
).set_sparam());
16611661
add_opt(common_arg(
16621662
{"--presence-penalty"}, "N",
1663-
string_format("repeat alpha presence penalty (default: %.1f, 0.0 = disabled)", (double)params.sampling.penalty_present),
1663+
string_format("repeat alpha presence penalty (default: %.2f, 0.0 = disabled)", (double)params.sampling.penalty_present),
16641664
[](common_params & params, const std::string & value) {
16651665
params.sampling.penalty_present = std::stof(value);
16661666
}
16671667
).set_sparam());
16681668
add_opt(common_arg(
16691669
{"--frequency-penalty"}, "N",
1670-
string_format("repeat alpha frequency penalty (default: %.1f, 0.0 = disabled)", (double)params.sampling.penalty_freq),
1670+
string_format("repeat alpha frequency penalty (default: %.2f, 0.0 = disabled)", (double)params.sampling.penalty_freq),
16711671
[](common_params & params, const std::string & value) {
16721672
params.sampling.penalty_freq = std::stof(value);
16731673
}
16741674
).set_sparam());
16751675
add_opt(common_arg(
16761676
{"--dry-multiplier"}, "N",
1677-
string_format("set DRY sampling multiplier (default: %.1f, 0.0 = disabled)", (double)params.sampling.dry_multiplier),
1677+
string_format("set DRY sampling multiplier (default: %.2f, 0.0 = disabled)", (double)params.sampling.dry_multiplier),
16781678
[](common_params & params, const std::string & value) {
16791679
params.sampling.dry_multiplier = std::stof(value);
16801680
}
@@ -1755,14 +1755,14 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
17551755
).set_sparam());
17561756
add_opt(common_arg(
17571757
{"--dynatemp-range"}, "N",
1758-
string_format("dynamic temperature range (default: %.1f, 0.0 = disabled)", (double)params.sampling.dynatemp_range),
1758+
string_format("dynamic temperature range (default: %.2f, 0.0 = disabled)", (double)params.sampling.dynatemp_range),
17591759
[](common_params & params, const std::string & value) {
17601760
params.sampling.dynatemp_range = std::stof(value);
17611761
}
17621762
).set_sparam());
17631763
add_opt(common_arg(
17641764
{"--dynatemp-exp"}, "N",
1765-
string_format("dynamic temperature exponent (default: %.1f)", (double)params.sampling.dynatemp_exponent),
1765+
string_format("dynamic temperature exponent (default: %.2f)", (double)params.sampling.dynatemp_exponent),
17661766
[](common_params & params, const std::string & value) {
17671767
params.sampling.dynatemp_exponent = std::stof(value);
17681768
}
@@ -1778,15 +1778,15 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
17781778
).set_sparam());
17791779
add_opt(common_arg(
17801780
{"--mirostat-lr"}, "N",
1781-
string_format("Mirostat learning rate, parameter eta (default: %.1f)", (double)params.sampling.mirostat_eta),
1781+
string_format("Mirostat learning rate, parameter eta (default: %.2f)", (double)params.sampling.mirostat_eta),
17821782
[](common_params & params, const std::string & value) {
17831783
params.sampling.mirostat_eta = std::stof(value);
17841784
params.sampling.user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_MIROSTAT_ETA;
17851785
}
17861786
).set_sparam());
17871787
add_opt(common_arg(
17881788
{"--mirostat-ent"}, "N",
1789-
string_format("Mirostat target entropy, parameter tau (default: %.1f)", (double)params.sampling.mirostat_tau),
1789+
string_format("Mirostat target entropy, parameter tau (default: %.2f)", (double)params.sampling.mirostat_tau),
17901790
[](common_params & params, const std::string & value) {
17911791
params.sampling.mirostat_tau = std::stof(value);
17921792
params.sampling.user_sampling_config |= common_params_sampling_config::COMMON_PARAMS_SAMPLING_CONFIG_MIROSTAT_TAU;
@@ -1920,28 +1920,28 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
19201920
).set_env("LLAMA_ARG_YARN_ORIG_CTX"));
19211921
add_opt(common_arg(
19221922
{"--yarn-ext-factor"}, "N",
1923-
string_format("YaRN: extrapolation mix factor (default: %.1f, 0.0 = full interpolation)", (double)params.yarn_ext_factor),
1923+
string_format("YaRN: extrapolation mix factor (default: %.2f, 0.0 = full interpolation)", (double)params.yarn_ext_factor),
19241924
[](common_params & params, const std::string & value) {
19251925
params.yarn_ext_factor = std::stof(value);
19261926
}
19271927
).set_env("LLAMA_ARG_YARN_EXT_FACTOR"));
19281928
add_opt(common_arg(
19291929
{"--yarn-attn-factor"}, "N",
1930-
string_format("YaRN: scale sqrt(t) or attention magnitude (default: %.1f)", (double)params.yarn_attn_factor),
1930+
string_format("YaRN: scale sqrt(t) or attention magnitude (default: %.2f)", (double)params.yarn_attn_factor),
19311931
[](common_params & params, const std::string & value) {
19321932
params.yarn_attn_factor = std::stof(value);
19331933
}
19341934
).set_env("LLAMA_ARG_YARN_ATTN_FACTOR"));
19351935
add_opt(common_arg(
19361936
{"--yarn-beta-slow"}, "N",
1937-
string_format("YaRN: high correction dim or alpha (default: %.1f)", (double)params.yarn_beta_slow),
1937+
string_format("YaRN: high correction dim or alpha (default: %.2f)", (double)params.yarn_beta_slow),
19381938
[](common_params & params, const std::string & value) {
19391939
params.yarn_beta_slow = std::stof(value);
19401940
}
19411941
).set_env("LLAMA_ARG_YARN_BETA_SLOW"));
19421942
add_opt(common_arg(
19431943
{"--yarn-beta-fast"}, "N",
1944-
string_format("YaRN: low correction dim or beta (default: %.1f)", (double)params.yarn_beta_fast),
1944+
string_format("YaRN: low correction dim or beta (default: %.2f)", (double)params.yarn_beta_fast),
19451945
[](common_params & params, const std::string & value) {
19461946
params.yarn_beta_fast = std::stof(value);
19471947
}
@@ -3335,14 +3335,14 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
33353335
).set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_LOOKUP, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_DRAFT_MIN"));
33363336
add_opt(common_arg(
33373337
{"--draft-p-split"}, "P",
3338-
string_format("speculative decoding split probability (default: %.1f)", (double)params.speculative.p_split),
3338+
string_format("speculative decoding split probability (default: %.2f)", (double)params.speculative.p_split),
33393339
[](common_params & params, const std::string & value) {
33403340
params.speculative.p_split = std::stof(value);
33413341
}
33423342
).set_examples({LLAMA_EXAMPLE_SPECULATIVE}).set_env("LLAMA_ARG_DRAFT_P_SPLIT"));
33433343
add_opt(common_arg(
33443344
{"--draft-p-min"}, "P",
3345-
string_format("minimum speculative decoding probability (greedy) (default: %.1f)", (double)params.speculative.p_min),
3345+
string_format("minimum speculative decoding probability (greedy) (default: %.2f)", (double)params.speculative.p_min),
33463346
[](common_params & params, const std::string & value) {
33473347
params.speculative.p_min = std::stof(value);
33483348
}

0 commit comments

Comments
 (0)