]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
perplexity : ndot progress and show stats with < 100 tasks (#7348)
authorstrawberrymelonpanda <redacted>
Sat, 18 May 2024 07:57:08 +0000 (00:57 -0700)
committerGitHub <redacted>
Sat, 18 May 2024 07:57:08 +0000 (10:57 +0300)
Fix floating point error with ndot printing, allow end stats on lower task numbers if multiple-choice tasks.

examples/perplexity/perplexity.cpp

index db6e0949d4c47a800b09d565d1b7162bbe4559d7..bae014e6f4c160001422b31f148a63d3a900319b 100644 (file)
@@ -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));