Skip to content

Commit 3ea913f

Browse files
authored
perplexity: give more information about constraints on failure (#15303)
* perplexity: give more information about constraints on failure This checks whether -np is insufficient vs context, and provides clues as to how much is needed for each. * log formatting * log error and return instead of storing max_seq_exceeded int * check if s0 is zero for -np check
1 parent 29c8fbe commit 3ea913f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tools/perplexity/perplexity.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static void hellaswag_score(llama_context * ctx, const common_params & params) {
920920
}
921921

922922
if (i0 == i1) {
923-
LOG_ERR("%s : task %zu does not fit in the context window\n", __func__, i0);
923+
LOG_ERR("%s : task %zu does not fit in the context window (requires %lu tokens)\n", __func__, i0, hs_data[i0].required_tokens);
924924
return;
925925
}
926926

@@ -1213,7 +1213,7 @@ static void winogrande_score(llama_context * ctx, const common_params & params)
12131213
}
12141214

12151215
if (i0 == i1) {
1216-
LOG_ERR("%s : task %zu does not fit in the context window\n", __func__, i0);
1216+
LOG_ERR("%s : task %zu does not fit in the context window (requires %lu tokens)\n", __func__, i0, data[i0].required_tokens);
12171217
return;
12181218
}
12191219

@@ -1548,6 +1548,10 @@ static void multiple_choice_score(llama_context * ctx, const common_params & par
15481548

15491549
int num_answers = cur_task.seq_tokens.size();
15501550
if (s0 + num_answers > max_seq) {
1551+
if (s0 == 0) {
1552+
LOG_ERR("%s : task %zu requires a higher -np|--parallel value (at least %d)\n", __func__, i0, num_answers);
1553+
return;
1554+
}
15511555
break;
15521556
}
15531557

@@ -1588,7 +1592,7 @@ static void multiple_choice_score(llama_context * ctx, const common_params & par
15881592
}
15891593

15901594
if (i0 == i1) {
1591-
LOG_ERR("%s : task %zu does not fit in the context window\n", __func__, i0);
1595+
LOG_ERR("%s : task %zu does not fit in the context window (requires %lu tokens)\n", __func__, i0, tasks[i0].required_tokens);
15921596
return;
15931597
}
15941598

0 commit comments

Comments
 (0)