Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3a29d65

Browse filesBrowse files
committed
Update llama.cpp
1 parent 5de8009 commit 3a29d65
Copy full SHA for 3a29d65

File tree

Expand file treeCollapse file tree

3 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+5
-5
lines changed

‎llama_cpp/llama.py

Copy file name to clipboardExpand all lines: llama_cpp/llama.py
+1-1Lines 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

Copy file name to clipboardExpand all lines: tests/test_llama.py
+3-3Lines 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

Copy file name to clipboard

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.