From c36ab15e68b9686c6031552b4944f6d4cb09aebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigbj=C3=B8rn=20Skj=C3=A6ret?= Date: Wed, 28 Feb 2024 07:30:31 +0100 Subject: [PATCH] fix: eos/bos_token set correctly for Jinja2ChatFormatter and automatic chat formatter (#1230) The token strings were not correctly retrieved (empty). --- llama_cpp/llama.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 81bfce4..d1bac9b 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -408,8 +408,8 @@ class Llama: except: bos_token_id = self.token_bos() - eos_token = self.detokenize([eos_token_id]).decode("utf-8") - bos_token = self.detokenize([bos_token_id]).decode("utf-8") + eos_token = self._model.token_get_text(eos_token_id) + bos_token = self._model.token_get_text(bos_token_id) if self.verbose: print(f"Using chat template: {template}", file=sys.stderr)