From e1f0a0dc7488d4a38b687d4d894dce722de050aa Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 12 Jul 2023 09:35:56 -0700 Subject: [PATCH] fix eof error in generate --- llama/llama.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llama/llama.go b/llama/llama.go index af452f97..8922c18f 100644 --- a/llama/llama.go +++ b/llama/llama.go @@ -199,10 +199,10 @@ func (llm *llama) generate(tokens []C.llama_token, fn func(string)) error { token, err := llm.sample(pastTokens, &opts) switch { - case err != nil: - return err case errors.Is(err, io.EOF): return nil + case err != nil: + return err } fn(llm.detokenize(token))