From 347247a24ec0db754216b7d466bac021bef9ae6a Mon Sep 17 00:00:00 2001 From: Francis Couture-Harpin Date: Tue, 20 Aug 2024 15:35:56 -0400 Subject: [PATCH] imatrix : fix segfault when using a single chunk per batch --- examples/imatrix/imatrix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/imatrix/imatrix.cpp b/examples/imatrix/imatrix.cpp index 7b91a7e306f57..6135f00a7e8c1 100644 --- a/examples/imatrix/imatrix.cpp +++ b/examples/imatrix/imatrix.cpp @@ -564,7 +564,7 @@ static bool compute_imatrix(llama_context * ctx, const gpt_params & params, cons if (params.compute_ppl) { const int first = n_ctx/2; for (int seq = 0; seq < n_seq_batch; seq++) { - const float * all_logits = num_batches > 1 ? logits.data() : llama_get_logits_ith(ctx, seq*n_ctx + first); + const float * all_logits = num_batches > 1 ? logits.data() : llama_get_logits_ith(ctx, seq*n_ctx); llama_token * tokens_data = tokens.data() + start + seq*n_ctx + first;