From 807ace5b1f4fc9de7347297b3c8a695c566d9fd9 Mon Sep 17 00:00:00 2001 From: Gabe Goodhart Date: Tue, 19 Nov 2024 15:58:14 -0700 Subject: [PATCH] fix(runner): Set logits to 0 if false on Batch.Add https://github.com/ollama/ollama/issues/7656 Branch: Granite3StoppingBug-7656 Signed-off-by: Gabe Goodhart --- llama/llama.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llama/llama.go b/llama/llama.go index 72b8b691..a3fbbc1d 100644 --- a/llama/llama.go +++ b/llama/llama.go @@ -384,6 +384,8 @@ func (b *Batch) Add(token int, embed []float32, pos int, logits bool, seqIds ... if logits { unsafe.Slice(b.c.logits, b.allocSize())[b.c.n_tokens] = 1 + } else { + unsafe.Slice(b.c.logits, b.allocSize())[b.c.n_tokens] = 0 } b.c.n_tokens += 1