@@ -203,6 +203,25 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) {
203
203
params.prompt_cache_all = true ;
204
204
} else if (arg == " --prompt-cache-ro" ) {
205
205
params.prompt_cache_ro = true ;
206
+ } else if (arg == " -bf" || arg == " --binary-file" ) {
207
+ if (++i >= argc) {
208
+ invalid_param = true ;
209
+ break ;
210
+ }
211
+ std::ifstream file (argv[i], std::ios::binary);
212
+ if (!file) {
213
+ fprintf (stderr, " error: failed to open file '%s'\n " , argv[i]);
214
+ invalid_param = true ;
215
+ break ;
216
+ }
217
+ // store the external file name in params
218
+ params.prompt_file = argv[i];
219
+ file.seekg (0 , std::ios::end);
220
+ size_t size = file.tellg ();
221
+ file.seekg (0 , std::ios::beg);
222
+ params.prompt .resize (size);
223
+ file.read ((char *)params.prompt .data (), size);
224
+ fprintf (stderr, " Read %zu bytes from binary file %s\n " , size, argv[i]);
206
225
} else if (arg == " -f" || arg == " --file" ) {
207
226
if (++i >= argc) {
208
227
invalid_param = true ;
@@ -653,6 +672,12 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) {
653
672
if (params.logdir .back () != DIRECTORY_SEPARATOR) {
654
673
params.logdir += DIRECTORY_SEPARATOR;
655
674
}
675
+ } else if (arg == " --save-all-logits" || arg == " --kl-divergence-base" ) {
676
+ if (++i >= argc) {
677
+ invalid_param = true ;
678
+ break ;
679
+ }
680
+ params.logits_file = argv[i];
656
681
} else if (arg == " --perplexity" || arg == " --all-logits" ) {
657
682
params.logits_all = true ;
658
683
} else if (arg == " --ppl-stride" ) {
@@ -689,6 +714,16 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) {
689
714
break ;
690
715
}
691
716
params.winogrande_tasks = std::stoi (argv[i]);
717
+ } else if (arg == " --multiple-choice" ) {
718
+ params.multiple_choice = true ;
719
+ } else if (arg == " --multiple-choice-tasks" ) {
720
+ if (++i >= argc) {
721
+ invalid_param = true ;
722
+ break ;
723
+ }
724
+ params.multiple_choice_tasks = std::stoi (argv[i]);
725
+ } else if (arg == " --kl-divergence" ) {
726
+ params.kl_divergence = true ;
692
727
} else if (arg == " --ignore-eos" ) {
693
728
params.ignore_eos = true ;
694
729
} else if (arg == " --no-penalize-nl" ) {
@@ -888,6 +923,8 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
888
923
printf (" --in-suffix STRING string to suffix after user inputs with (default: empty)\n " );
889
924
printf (" -f FNAME, --file FNAME\n " );
890
925
printf (" prompt file to start generation.\n " );
926
+ printf (" -bf FNAME, --binary-file FNAME\n " );
927
+ printf (" binary file containing multiple choice tasks.\n " );
891
928
printf (" -n N, --n-predict N number of tokens to predict (default: %d, -1 = infinity, -2 = until context filled)\n " , params.n_predict );
892
929
printf (" -c N, --ctx-size N size of the prompt context (default: %d, 0 = loaded from model)\n " , params.n_ctx );
893
930
printf (" -b N, --batch-size N batch size for prompt processing (default: %d)\n " , params.n_batch );
@@ -936,6 +973,9 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
936
973
printf (" --hellaswag-tasks N number of tasks to use when computing the HellaSwag score (default: %zu)\n " , params.hellaswag_tasks );
937
974
printf (" --winogrande compute Winogrande score over random tasks from datafile supplied with -f\n " );
938
975
printf (" --winogrande-tasks N number of tasks to use when computing the Winogrande score (default: %zu)\n " , params.winogrande_tasks );
976
+ printf (" --multiple-choice compute multiple choice score over random tasks from datafile supplied with -f\n " );
977
+ printf (" --multiple-choice-tasks N number of tasks to use when computing the multiple choice score (default: %zu)\n " , params.winogrande_tasks );
978
+ printf (" --kl-divergence computes KL-divergence to logits provided via --kl-divergence-base" );
939
979
printf (" --keep N number of tokens to keep from the initial prompt (default: %d, -1 = all)\n " , params.n_keep );
940
980
printf (" --draft N number of tokens to draft for speculative decoding (default: %d)\n " , params.n_draft );
941
981
printf (" --chunks N max number of chunks to process (default: %d, -1 = all)\n " , params.n_chunks );
0 commit comments