From 3a29d65f456c8a3445f3a0fe1e0cde68debf6e5f Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Sat, 26 Aug 2023 23:36:24 -0400 Subject: [PATCH] Update llama.cpp --- llama_cpp/llama.py | 2 +- tests/test_llama.py | 6 +++--- vendor/llama.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index fd3e2c4..49c98fd 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -455,7 +455,7 @@ class Llama: output += bytes(buffer[:n]) # NOTE: Llama1 models automatically added a space at the start of the prompt # this line removes a leading space if the first token is a beginning of sentence token - return output[1:] if len(tokens) > 0 and tokens[0] == self.token_bos() else output + return output def set_cache(self, cache: Optional[BaseLlamaCache]): """Set the cache. diff --git a/tests/test_llama.py b/tests/test_llama.py index c240122..e038a89 100644 --- a/tests/test_llama.py +++ b/tests/test_llama.py @@ -14,16 +14,16 @@ def test_llama_cpp_tokenization(): tokens = llama.tokenize(text) assert tokens[0] == llama.token_bos() - assert tokens == [1, 15043, 2787] + assert tokens == [1, 10994, 2787] detokenized = llama.detokenize(tokens) assert detokenized == text tokens = llama.tokenize(text, add_bos=False) assert tokens[0] != llama.token_bos() - assert tokens == [15043, 2787] + assert tokens == [10994, 2787] detokenized = llama.detokenize(tokens) - assert detokenized != text + assert detokenized == text @pytest.mark.skip(reason="bug in tokenization where leading space is always inserted even if not after eos") diff --git a/vendor/llama.cpp b/vendor/llama.cpp index 232caf3..c1ac54b 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit 232caf3c1581a6cb023571780ff41dc2d66d1ca0 +Subproject commit c1ac54b77aaba10d029084d152be786102010eb2