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