From b3317b9fda9095f2edf5eab3dacf9c1d2f923369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Th=C3=BCning?= Date: Sat, 9 Dec 2023 05:01:34 +0100 Subject: [PATCH] fix allocation of scaling factors --- runq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runq.c b/runq.c index 8c95a912..9fa262dc 100644 --- a/runq.c +++ b/runq.c @@ -96,8 +96,8 @@ void malloc_run_state(RunState* s, Config* p) { s->xb2 = calloc(p->dim, sizeof(float)); s->hb = calloc(p->hidden_dim, sizeof(float)); s->hb2 = calloc(p->hidden_dim, sizeof(float)); - s->xq = (QuantizedTensor) { .q = calloc(p->dim, sizeof(int8_t)), .s = calloc(p->dim, sizeof(float)) }; - s->hq = (QuantizedTensor) { .q = calloc(p->hidden_dim, sizeof(int8_t)), .s = calloc(p->hidden_dim, sizeof(float)) }; + s->xq = (QuantizedTensor) { .q = calloc(p->dim, sizeof(int8_t)), .s = calloc(p->dim / GS, sizeof(float)) }; + s->hq = (QuantizedTensor) { .q = calloc(p->hidden_dim, sizeof(int8_t)), .s = calloc(p->hidden_dim / GS, sizeof(float)) }; s->q = calloc(p->dim, sizeof(float)); s->k = calloc(kv_dim, sizeof(float)); s->v = calloc(kv_dim, sizeof(float));