Update llama.cpp

This commit is contained in:
Andrei Betlen 2023-09-18 16:11:27 -04:00
parent 8d75016549
commit 38e34c97f0
3 changed files with 11 additions and 4 deletions

View file

@ -430,6 +430,7 @@ class Llama:
n_tokens = llama_cpp.llama_tokenize_with_model(
self.model,
text,
len(text),
tokens,
n_ctx,
add_bos,
@ -440,6 +441,7 @@ class Llama:
n_tokens = llama_cpp.llama_tokenize_with_model(
self.model,
text,
len(text),
tokens,
n_tokens,
add_bos,

View file

@ -950,42 +950,47 @@ _lib.llama_token_nl.restype = llama_token
# LLAMA_API int llama_tokenize(
# struct llama_context * ctx,
# const char * text,
# int text_len,
# llama_token * tokens,
# int n_max_tokens,
# bool add_bos);
def llama_tokenize(
ctx: llama_context_p,
text: bytes,
text_len: Union[c_int, int],
tokens, # type: Array[llama_token]
n_max_tokens: Union[c_int, int],
add_bos: Union[c_bool, int],
) -> int:
return _lib.llama_tokenize(ctx, text, tokens, n_max_tokens, add_bos)
return _lib.llama_tokenize(ctx, text, text_len, tokens, n_max_tokens, add_bos)
_lib.llama_tokenize.argtypes = [llama_context_p, c_char_p, llama_token_p, c_int, c_bool]
_lib.llama_tokenize.argtypes = [llama_context_p, c_char_p, c_int, llama_token_p, c_int, c_bool]
_lib.llama_tokenize.restype = c_int
# LLAMA_API int llama_tokenize_with_model(
# const struct llama_model * model,
# const char * text,
# int text_len,
# llama_token * tokens,
# int n_max_tokens,
# bool add_bos);
def llama_tokenize_with_model(
model: llama_model_p,
text: bytes,
text_len: Union[c_int, int],
tokens, # type: Array[llama_token]
n_max_tokens: Union[c_int, int],
add_bos: Union[c_bool, bool],
) -> int:
return _lib.llama_tokenize_with_model(model, text, tokens, n_max_tokens, add_bos)
return _lib.llama_tokenize_with_model(model, text, text_len, tokens, n_max_tokens, add_bos)
_lib.llama_tokenize_with_model.argtypes = [
llama_model_p,
c_char_p,
c_int,
llama_token_p,
c_int,
c_bool,

2
vendor/llama.cpp vendored

@ -1 +1 @@
Subproject commit 80291a1d02a07f7f66666fb576c5b1e75aa48b46
Subproject commit 8781013ef654270cbead3e0011e33a6d690fb168