Update API to match latest llama.cpp version#1991
Open
mamei16 wants to merge 3 commits intoabetlen:mainfrom
Open
Update API to match latest llama.cpp version#1991mamei16 wants to merge 3 commits intoabetlen:mainfrom
mamei16 wants to merge 3 commits intoabetlen:mainfrom
Conversation
mamei16
commented
Apr 3, 2025
| class llama_model_tensor_buft_override(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("pattern", ctypes.c_char_p), | ||
| ("buft", ctypes.c_void_p) |
Author
There was a problem hiding this comment.
I wasn't sure if c_void_p is the correct type to use here, so feel free to change it if there's a better alternative.
jonathanreichhealthscope
left a comment
There was a problem hiding this comment.
Looks great. Seems like there's a couple extra?
@ctypes_function(
"llama_load_model_from_file",
[ctypes.c_char_p, llama_model_params],
llama_model_p_ctypes,
)
def llama_load_model_from_file(
path_model: bytes, params: llama_model_params, /
) -> Optional[llama_model_p]:
...
# LLAMA_API void llama_model_free(struct llama_model * model);
@ctypes_function(
"llama_model_free",
[llama_model_p_ctypes],
None,
)
def llama_model_free(model: llama_model_p, /):
...
Author
|
@jonathanreichhealthscope Thanks! What do you mean by that? |
Looks like there's a couple of extra API changes, that's what I've put in my comment. For example, the 'llama_load_model_from_file' is now best practice to use, as the former naming convention I think is deprecated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates llama_cpp.py so that it matches the llama.h API changes introduced in the commits:
ggml-org/llama.cpp@e0dbec0
ggml-org/llama.cpp@8fcb563
ggml-org/llama.cpp@00d5380
ggml-org/llama.cpp@dd373dd
ggml-org/llama.cpp@b3de7ca
ggml-org/llama.cpp@2c3f8b8
ggml-org/llama.cpp@e0e912f
I couldn't find any example on how to handle deprecated methods in this project, so I added a
@deprecateddecorator to the methods in question.