LLM: fix llm pybinding (#8509)

This commit is contained in:
Yishuo Wang 2023-07-13 10:27:08 +08:00 committed by GitHub
parent fcc352eee3
commit 86b5938075
2 changed files with 6 additions and 4 deletions

View file

@ -54,6 +54,7 @@ from ctypes import (
c_char_p,
c_void_p,
c_bool,
pointer,
POINTER,
_Pointer, # type: ignore
Structure,
@ -230,10 +231,10 @@ _lib.gptneox_mlock_supported.restype = c_bool
def gptneox_init_from_file(
path_model: bytes, params: gptneox_context_params
) -> gptneox_context_p:
return _lib.gptneox_init_from_file(path_model, params)
return _lib.gptneox_init_from_file(path_model, pointer(params))
_lib.gptneox_init_from_file.argtypes = [c_char_p, gptneox_context_params]
_lib.gptneox_init_from_file.argtypes = [c_char_p, gptneox_context_params_p]
_lib.gptneox_init_from_file.restype = gptneox_context_p

View file

@ -54,6 +54,7 @@ from ctypes import (
c_char_p,
c_void_p,
c_bool,
pointer,
POINTER,
_Pointer, # type: ignore
Structure,
@ -307,10 +308,10 @@ _lib.llama_time_us.restype = ctypes.c_int64
def llama_init_from_file(
path_model: bytes, params: llama_context_params
) -> llama_context_p:
return _lib.llama_init_from_file(path_model, params)
return _lib.llama_init_from_file(path_model, pointer(params))
_lib.llama_init_from_file.argtypes = [c_char_p, llama_context_params]
_lib.llama_init_from_file.argtypes = [c_char_p, llama_context_params_p]
_lib.llama_init_from_file.restype = llama_context_p