summaryrefslogtreecommitdiff
path: root/examples/perplexity/perplexity.cpp
diff options
context:
space:
mode:
authorstrawberrymelonpanda <152940198+strawberrymelonpanda@users.noreply.github.com>2024-05-18 00:57:08 -0700
committerGitHub <noreply@github.com>2024-05-18 10:57:08 +0300
commitca57e0f35e33f714b9a6c2c4482b87bfe059c819 (patch)
tree147faabb80cbd0ee96bba03519d23cdf80736aa4 /examples/perplexity/perplexity.cpp
parentc1b295eea5c49887a066559527a74e8b94fe9db0 (diff)
perplexity : ndot progress and show stats with < 100 tasks (#7348)
Fix floating point error with ndot printing, allow end stats on lower task numbers if multiple-choice tasks.
Diffstat (limited to 'examples/perplexity/perplexity.cpp')
-rw-r--r--examples/perplexity/perplexity.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/perplexity/perplexity.cpp b/examples/perplexity/perplexity.cpp
index db6e0949..bae014e6 100644
--- a/examples/perplexity/perplexity.cpp
+++ b/examples/perplexity/perplexity.cpp
@@ -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;
@@ -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));