@@ -391,7 +391,7 @@ void hellaswag_score(llama_context * ctx, const gpt_params & params) {
391
391
hs_data[i].context = prompt_lines[idx*6 ];
392
392
hs_data[i].gold_ending_idx = std::stoi ( prompt_lines[idx*6 +1 ] );
393
393
for (size_t j=0 ; j < 4 ; j++) {
394
- hs_data[i].ending [j] = " " + prompt_lines[idx*6 +2 +j];
394
+ hs_data[i].ending [j] = prompt_lines[idx*6 +2 +j];
395
395
}
396
396
397
397
// Delete the selected random example from the prompt
@@ -415,7 +415,7 @@ void hellaswag_score(llama_context * ctx, const gpt_params & params) {
415
415
416
416
// Do the 1st ending
417
417
// In this case we include the context when evaluating
418
- auto query_embd = ::llama_tokenize (ctx, hs_data[task_idx].context + hs_data[task_idx].ending [0 ], add_bos);
418
+ auto query_embd = ::llama_tokenize (ctx, hs_data[task_idx].context + " " + hs_data[task_idx].ending [0 ], add_bos);
419
419
auto query_size = query_embd.size ();
420
420
// printf("First query: %d\n",(int)query_size);
421
421
@@ -462,11 +462,11 @@ void hellaswag_score(llama_context * ctx, const gpt_params & params) {
462
462
for (size_t ending_idx = 1 ; ending_idx < 4 ; ending_idx++) {
463
463
464
464
// Tokenize the query
465
- // SPM tokenizer: Do not tokenize the starting space in the ending since it is always added by the tokenizer
465
+ // SPM tokenizer: Do not prepend a space since the tokenizer always do that
466
466
if (is_spm) {
467
- query_embd = ::llama_tokenize (ctx, hs_data[task_idx].ending [ending_idx].substr (1 ,hs_data[task_idx].ending [ending_idx].size ()-1 ), false );
468
- } else {
469
467
query_embd = ::llama_tokenize (ctx, hs_data[task_idx].ending [ending_idx], false );
468
+ } else {
469
+ query_embd = ::llama_tokenize (ctx, " " + hs_data[task_idx].ending [ending_idx], false );
470
470
}
471
471
472
472
query_size = query_embd.size ();
0 commit comments