From c216656990dc328915814663d55901d3df7a90bc Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sun, 7 May 2023 18:07:11 +0300 Subject: [PATCH] ggml : fix Q4_1 quantization --- ggml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ggml.c b/ggml.c index 763635fc2..2e64e889b 100644 --- a/ggml.c +++ b/ggml.c @@ -826,8 +826,8 @@ static void quantize_row_q4_1_reference(const float * restrict x, block_q4_1 * r y[i].m = min; for (int l = 0; l < qk/2; ++l) { - const float x0 = (x[0 + l] - min)*id; - const float x1 = (x[qk/2 + l] - min)*id; + const float x0 = (x[i*qk + 0 + l] - min)*id; + const float x1 = (x[i*qk + qk/2 + l] - min)*id; const uint8_t xi0 = MIN(15, (int8_t)(x0 + 0.5f)); const uint8_t xi1 = MIN(15, (int8_t)(x1 + 0.5f));