8000 Update llama.cpp · twobob/llama-cpp-python@3a29d65 · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit 3a29d65

Bro 8000 wse files
committed
Update llama.cpp
1 parent 5de8009 commit 3a29d65

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

llama_cpp/llama.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def detokenize(self, tokens: List[int]) -> bytes:
455455
output += bytes(buffer[:n])
456456
# NOTE: Llama1 models automatically added a space at the start of the prompt
457457
# this line removes a leading space if the first token is a beginning of sentence token
458-
return output[1:] if len(tokens) > 0 and tokens[0] == self.token_bos() else output
458+
return output
459459

460460
def set_cache(self, cache: Optional[BaseLlamaCache]):
461461
"""Set the cache.

tests/test_llama.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ def test_llama_cpp_tokenization():
1414

1515
tokens = llama.tokenize(text)
1616
assert tokens[0] == llama.token_bos()
17-
assert tokens == [1, 15043, 2787]
17+
assert tokens == [1, 10994, 2787]
1818
detokenized = llama.detokenize(tokens)
1919
assert detokenized == text
2020

2121
tokens = llama.tokenize(text, add_bos=False)
2222
assert tokens[0] != llama.token_bos()
23-
assert tokens == [15043, 2787]
23+
assert tokens == [10994, 2787]
2424

2525
detokenized = llama.detokenize(tokens)
26-
assert detokenized != text
26+
assert detokenized == text
2727

2828

2929
@pytest.mark.skip(reason="bug in tokenization where leading space is always inserted even if not after eos")

vendor/llama.cpp

0 commit comments

Comments
 (0)
0