From d40a250ef3cfaa8224d12c83776a2f1de96ae3d1 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Mon, 22 Apr 2024 00:35:47 -0400 Subject: [PATCH] feat: Use new llama_token_is_eog in create_completions --- llama_cpp/llama.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 818be82..0a576d4 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -1034,7 +1034,8 @@ class Llama: logits_processor=logits_processor, grammar=grammar, ): - if token == self._token_eos: + assert self._model.model is not None + if llama_cpp.llama_token_is_eog(self._model.model, token): text = self.detokenize(completion_tokens, prev_tokens=prompt_tokens) finish_reason = "stop" break