Skip to content

Commit

Permalink
perplexity : ndot progress and show stats with < 100 tasks (#7348)
Browse files Browse the repository at this point in the history
Fix floating point error with ndot printing, allow end stats on lower task numbers if multiple-choice tasks.
  • Loading branch information
strawberrymelonpanda authored May 18, 2024
1 parent c1b295e commit ca57e0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/perplexity/perplexity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ static void multiple_choice_score(llama_context * ctx, const gpt_params & params
// Use all tasks
tasks.resize(n_task);
printf("%s: reading tasks", __func__);
int n_dot = n_task/100;
int n_dot = std::max((int) n_task/100, 1);
int i = 0;
for (auto& task : tasks) {
++i;
Expand Down Expand Up @@ -1675,7 +1675,7 @@ static void multiple_choice_score(llama_context * ctx, const gpt_params & params

llama_batch_free(batch);

if (n_done < 100) return;
if (n_done < 100 && (params.multiple_choice_tasks != 0 && params.multiple_choice_tasks < (size_t)n_task)) return;

float p = 1.f*n_correct/n_done;
float sigma = sqrt(p*(1-p)/(n_done-1));
Expand Down

0 comments on commit ca57e0f

Please sign in to comment.