We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8fa2ef1 commit 5be8354Copy full SHA for 5be8354
llama_cpp/llama.py
@@ -1416,8 +1416,10 @@ class LlamaTokenizer:
1416
def __init__(self, llama: Llama):
1417
self.llama = llama
1418
1419
- def encode(self, text: str) -> List[int]:
1420
- return self.llama.tokenize(text.encode("utf-8", errors="ignore"))
+ def encode(self, text: str, add_bos: bool = True) -> List[int]:
+ return self.llama.tokenize(
1421
+ text.encode("utf-8", errors="ignore"), add_bos=add_bos
1422
+ )
1423
1424
def decode(self, tokens: List[int]) -> str:
1425
return self.llama.detokenize(tokens).decode("utf-8", errors="ignore")
0 commit comments