@@ -22,6 +22,11 @@ common_arg & common_arg::set_examples(std::initializer_list<enum llama_example>
22
22
return *this ;
23
23
}
24
24
25
+ common_arg & common_arg::set_excludes (std::initializer_list<enum llama_example> excludes) {
26
+ this ->excludes = std::move (excludes);
27
+ return *this ;
28
+ }
29
+
25
30
common_arg & common_arg::set_env (const char * env) {
26
31
help = help + " \n (env: " + env + " )" ;
27
32
this ->env = env;
@@ -37,6 +42,10 @@ bool common_arg::in_example(enum llama_example ex) {
37
42
return examples.find (ex) != examples.end ();
38
43
}
39
44
45
+ bool common_arg::is_exclude (enum llama_example ex) {
46
+ return excludes.find (ex) != excludes.end ();
47
+ }
48
+
40
49
bool common_arg::get_value_from_env (std::string & output) {
41
50
if (env == nullptr ) return false ;
42
51
char * value = std::getenv (env);
@@ -420,7 +429,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
420
429
* - if both {LLAMA_EXAMPLE_COMMON, LLAMA_EXAMPLE_*,} are set, we will prioritize the LLAMA_EXAMPLE_* matching current example
421
430
*/
422
431
auto add_opt = [&](common_arg arg) {
423
- if (arg.in_example (ex) || arg.in_example (LLAMA_EXAMPLE_COMMON)) {
432
+ if (( arg.in_example (ex) || arg.in_example (LLAMA_EXAMPLE_COMMON)) && !arg. is_exclude (ex )) {
424
433
ctx_arg.options .push_back (std::move (arg));
425
434
}
426
435
};
@@ -649,7 +658,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
649
658
[](common_params & params, const std::string & value) {
650
659
params.prompt = value;
651
660
}
652
- ));
661
+ ). set_excludes ({LLAMA_EXAMPLE_SERVER}) );
653
662
add_opt (common_arg (
654
663
{" --no-perf" },
655
664
string_format (" disable internal libllama performance timings (default: %s)" , params.no_perf ? " true" : " false" ),
@@ -673,7 +682,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
673
682
params.prompt .pop_back ();
674
683
}
675
684
}
676
- ));
685
+ ). set_excludes ({LLAMA_EXAMPLE_SERVER}) );
677
686
add_opt (common_arg (
678
687
{" --in-file" }, " FNAME" ,
679
688
" an input file (repeat to specify multiple files)" ,
@@ -700,7 +709,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
700
709
params.prompt = ss.str ();
701
710
fprintf (stderr, " Read %zu bytes from binary file %s\n " , params.prompt .size (), value.c_str ());
702
711
}
703
- ));
712
+ ). set_excludes ({LLAMA_EXAMPLE_SERVER}) );
704
713
add_opt (common_arg (
705
714
{" -e" , " --escape" },
706
715
string_format (" process escapes sequences (\\ n, \\ r, \\ t, \\ ', \\\" , \\\\ ) (default: %s)" , params.escape ? " true" : " false" ),
0 commit comments