Add static methods for beginning and end of sequence tokens.

This commit is contained in:
Andrei Betlen
2023-04-01 17:29:30 -04:00
parent caff127836
commit 67c70cc8eb
2 changed files with 12 additions and 0 deletions

View File

@@ -446,3 +446,13 @@ class Llama:
if self.ctx is not None:
llama_cpp.llama_free(self.ctx)
self.ctx = None
@staticmethod
def token_eos() -> llama_cpp.llama_token:
"""Return the end-of-sequence token."""
return llama_cpp.llama_token_eos()
@staticmethod
def token_bos() -> llama_cpp.llama_token:
"""Return the beginning-of-sequence token."""
return llama_cpp.llama_token_bos()