1
1
#include " arg.h"
2
2
3
+ #include " log.h"
3
4
#include " sampling.h"
4
5
5
6
#include < algorithm>
6
- #include < string>
7
- #include < vector>
8
- #include < set>
7
+ #include < climits>
8
+ #include < cstdarg>
9
9
#include < fstream>
10
10
#include < regex>
11
- #include < cstdarg>
12
- #include < climits>
11
+ #include < set>
12
+ #include < string>
13
+ #include < thread>
14
+ #include < vector>
13
15
14
16
#include " json-schema-to-grammar.h"
15
17
@@ -383,20 +385,6 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
383
385
exit (0 );
384
386
}
385
387
));
386
- add_opt (llama_arg (
387
- {" -v" , " --verbose" },
388
- " print verbose information" ,
389
- [](gpt_params & params) {
390
- params.verbosity = 1 ;
391
- }
392
- ));
393
- add_opt (llama_arg (
394
- {" --verbosity" }, " N" ,
395
- format (" set specific verbosity level (default: %d)" , params.verbosity ),
396
- [](gpt_params & params, int value) {
397
- params.verbosity = value;
398
- }
399
- ));
400
388
add_opt (llama_arg (
401
389
{" --verbose-prompt" },
402
390
format (" print a verbose prompt before generation (default: %s)" , params.verbose_prompt ? " true" : " false" ),
@@ -417,7 +405,7 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
417
405
[](gpt_params & params) {
418
406
params.use_color = true ;
419
407
}
420
- ).set_examples ({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_INFILL}));
408
+ ).set_examples ({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_INFILL, LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_LOOKUP }));
421
409
add_opt (llama_arg (
422
410
{" -t" , " --threads" }, " N" ,
423
411
format (" number of threads to use during generation (default: %d)" , params.cpuparams .n_threads ),
@@ -876,15 +864,15 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
876
864
params.input_prefix = value;
877
865
params.enable_chat_template = false ;
878
866
}
879
- ).set_examples ({LLAMA_EXAMPLE_MAIN}));
867
+ ).set_examples ({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_INFILL }));
880
868
add_opt (llama_arg (
881
869
{" --in-suffix" }, " STRING" ,
882
870
" string to suffix after user inputs with (default: empty)" ,
883
871
[](gpt_params & params, const std::string & value) {
884
872
params.input_suffix = value;
885
873
params.enable_chat_template = false ;
886
874
}
887
- ).set_examples ({LLAMA_EXAMPLE_MAIN}));
875
+ ).set_examples ({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_INFILL }));
888
876
add_opt (llama_arg (
889
877
{" --no-warmup" },
890
878
" skip warming up the model with an empty run" ,
@@ -1824,19 +1812,6 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
1824
1812
params.system_prompt = system_prompt;
1825
1813
}
1826
1814
).set_examples ({LLAMA_EXAMPLE_SERVER}));
1827
- add_opt (llama_arg (
1828
- {" --log-format" }, " {text, json}" ,
1829
- " log output format: json or text (default: json)" ,
1830
- [](gpt_params & params, const std::string & value) {
1831
- if (value == " json" ) {
1832
- params.log_json = true ;
1833
- } else if (value == " text" ) {
1834
- params.log_json = false ;
1835
- } else {
1836
- throw std::invalid_argument (" invalid value" );
1837
- }
1838
- }
1839
- ).set_examples ({LLAMA_EXAMPLE_SERVER}));
1840
1815
add_opt (llama_arg (
1841
1816
{" --metrics" },
1842
1817
format (" enable prometheus compatible metrics endpoint (default: %s)" , params.endpoint_metrics ? " enabled" : " disabled" ),
@@ -1956,39 +1931,57 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
1956
1931
else { std::invalid_argument (" invalid value" ); }
1957
1932
}
1958
1933
).set_examples ({LLAMA_EXAMPLE_BENCH}));
1959
- #ifndef LOG_DISABLE_LOGS
1960
- // TODO: make this looks less weird
1961
- add_opt (llama_arg (
1962
- {" --log-test" },
1963
- " Log test" ,
1964
- [](gpt_params &) { log_param_single_parse (" --log-test" ); }
1965
- ));
1966
1934
add_opt (llama_arg (
1967
1935
{" --log-disable" },
1968
1936
" Log disable" ,
1969
- [](gpt_params &) { log_param_single_parse (" --log-disable" ); }
1937
+ [](gpt_params &) {
1938
+ gpt_log_pause (gpt_log_main ());
1939
+ }
1970
1940
));
1971
1941
add_opt (llama_arg (
1972
- {" --log-enable" },
1973
- " Log enable" ,
1974
- [](gpt_params &) { log_param_single_parse (" --log-enable" ); }
1942
+ {" --log-file" }, " FNAME" ,
1943
+ " Log to file" ,
1944
+ [](gpt_params &, const std::string & value) {
1945
+ gpt_log_set_file (gpt_log_main (), value.c_str ());
1946
+ }
1975
1947
));
1976
1948
add_opt (llama_arg (
1977
- {" --log-new" },
1978
- " Log new" ,
1979
- [](gpt_params &) { log_param_single_parse (" --log-new" ); }
1980
- ));
1949
+ {" --log-colors" },
1950
+ " Enable colored logging" ,
1951
+ [](gpt_params &) {
1952
+ gpt_log_set_colors (gpt_log_main (), true );
1953
+ }
1954
+ ).set_env (" LLAMA_LOG_COLORS" ));
1981
1955
add_opt (llama_arg (
1982
- {" --log-append" },
1983
- " Log append" ,
1984
- [](gpt_params &) { log_param_single_parse (" --log-append" ); }
1956
+ {" -v" , " --verbose" , " --log-verbose" },
1957
+ " Set verbosity level to infinity (i.e. log all messages, useful for debugging)" ,
1958
+ [](gpt_params & params) {
1959
+ params.verbosity = INT_MAX;
1960
+ gpt_log_set_verbosity_thold (INT_MAX);
1961
+ }
1985
1962
));
1986
1963
add_opt (llama_arg (
1987
- {" --log-file" }, " FNAME" ,
1988
- " Log file" ,
1989
- [](gpt_params &, const std::string & value) { log_param_pair_parse (false , " --log-file" , value); }
1990
- ));
1991
- #endif // LOG_DISABLE_LOGS
1964
+ {" -lv" , " --verbosity" , " --log-verbosity" }, " N" ,
1965
+ " Set the verbosity threshold. Messages with a higher verbosity will be ignored." ,
1966
+ [](gpt_params & params, int value) {
1967
+ params.verbosity = value;
1968
+ gpt_log_set_verbosity_thold (value);
1969
+ }
1970
+ ).set_env (" LLAMA_LOG_VERBOSITY" ));
1971
+ add_opt (llama_arg (
1972
+ {" --log-prefix" },
1973
+ " Enable prefx in log messages" ,
1974
+ [](gpt_params &) {
1975
+ gpt_log_set_prefix (gpt_log_main (), true );
1976
+ }
1977
+ ).set_env (" LLAMA_LOG_PREFIX" ));
1978
+ add_opt (llama_arg (
1979
+ {" --log-timestamps" },
1980
+ " Enable timestamps in log messages" ,
1981
+ [](gpt_params &) {
1982
+ gpt_log_set_timestamps (gpt_log_main (), true );
1983
+ }
1984
+ ).set_env (" LLAMA_LOG_TIMESTAMPS" ));
1992
1985
1993
1986
return ctx_arg;
1994
1987
}
0 commit comments