Update llama.cpp

This commit is contained in:
Andrei Betlen 2023-08-26 23:36:24 -04:00
parent 5de8009706
commit 3a29d65f45
3 changed files with 5 additions and 5 deletions

View file

@ -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.

View file

@ -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")

2
vendor/llama.cpp vendored

@ -1 +1 @@
Subproject commit 232caf3c1581a6cb023571780ff41dc2d66d1ca0
Subproject commit c1ac54b77aaba10d029084d152be786102010eb2