Commit 918fe468d for llama.cpp

commit 918fe468dbaae80bcdaf975c1b368023f2578ead
Author: Ed Addario <29247825+EAddario@users.noreply.github.com>
Date:   Sat Nov 28 22:03:31 2026 +0000

    Honor --chunks when using llama-perplexity with --kl-divergence (#32257)

    * Honour --chunks when using --kl-divergence
    * Fix formatting

diff --git a/tools/perplexity/perplexity.cpp b/tools/perplexity/perplexity.cpp
index 601361acd..079c1625f 100644
--- a/tools/perplexity/perplexity.cpp
+++ b/tools/perplexity/perplexity.cpp
@@ -1719,6 +1719,10 @@ static void kl_divergence(llama_context * ctx, const common_params & params) {
         return;
     }

+    if (params.n_chunks >= 0) {
+        n_chunk = std::min(n_chunk, params.n_chunks);
+    }
+
     const int n_batch = params.n_batch;
     const int num_batches = (static_cast<int>(n_ctx) + n_batch - 1) / n_batch;
     // Calculate n_seq based on the logits file's n_ctx, but cap it at what the context supports