Update llama.cpp · JDScript/llama-cpp-python@4887973 · GitHub
Skip to content

Commit 4887973

Browse files
committed
Update llama.cpp
1 parent 9ab49bc commit 4887973

4 files changed

Lines changed: 28 additions & 33 deletions

File tree

llama_cpp/llama.py

Lines changed: 3 additions & 3 deletions

llama_cpp/llama_cpp.py

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -973,48 +973,43 @@ def llama_tokenize_with_model(
973973
_lib.llama_tokenize_with_model.restype = c_int
974974

975975

976-
# // Token Id -> String. Uses the vocabulary in the provided context
977-
# // Does not write null terminator to the buffer
978-
# LLAMA_API int llama_token_to_str(
976+
# // Token Id -> Piece.
977+
# // Uses the vocabulary in the provided context.
978+
# // Does not write null terminator to the buffer.
979+
# // User code is responsible to remove the leading whitespace of the first non-BOS token when decoding multiple tokens.
980+
# LLAMA_API int llama_token_to_piece(
979981
# const struct llama_context * ctx,
980-
# llama_token token,
981-
# char * buf,
982-
# int length);
983-
def llama_token_to_str(
982+
# llama_token token,
983+
# char * buf,
984+
# int length);
985+
def llama_token_to_piece(
984986
ctx: llama_context_p, token: llama_token, buf: bytes, length: c_int
985987
) -> int:
986-
return _lib.llama_token_to_str(ctx, token, buf, length)
988+
return _lib.llama_token_to_piece(ctx, token, buf, length)
987989

988990

989-
_lib.llama_tokenize_with_model.argtypes = [
990-
llama_model_p,
991-
c_char_p,
992-
llama_token_p,
993-
c_int,
994-
c_bool,
995-
]
996-
_lib.llama_tokenize_with_model.restype = c_int
991+
_lib.llama_token_to_piece.argtypes = [llama_context_p, llama_token, c_char_p, c_int]
992+
_lib.llama_token_to_piece.restype = c_int
997993

998994

999-
# LLAMA_API int llama_token_to_str_with_model(
1000-
# const struct llama_model * model,
1001-
# llama_token token,
1002-
# char * buf,
1003-
# int length);
1004-
def llama_token_to_str_with_model(
995+
# LLAMA_API int llama_token_to_piece_with_model(
996+
# const struct llama_model * model,
997+
# llama_token token,
998+
# char * buf,
999+
# int length);
1000+
def llama_token_to_piece_with_model(
10051001
model: llama_model_p, token: llama_token, buf: bytes, length: c_int
10061002
) -> int:
1007-
return _lib.llama_token_to_str_with_model(model, token, buf, length)
1003+
return _lib.llama_token_to_piece_with_model(model, token, buf, length)
10081004

10091005

1010-
_lib.llama_token_to_str_with_model.argtypes = [
1006+
_lib.llama_token_to_piece_with_model.argtypes = [
10111007
llama_model_p,
10121008
llama_token,
10131009
c_char_p,
10141010
c_int,
10151011
]
1016-
_lib.llama_token_to_str_with_model.restype = c_int
1017-
1012+
_lib.llama_token_to_piece_with_model.restype = c_int
10181013

10191014
# //
10201015
# // Grammar

tests/test_llama.py

Lines changed: 3 additions & 3 deletions

vendor/llama.cpp

0 commit comments

Comments
 (0)