Skip to content

Commit 8b38e72

Browse files
committed
Update Submodule vendor/llama.cpp 4f31eed..fdb1db8
Signed-off-by: JamePeng <jame_peng@sina.com>
1 parent 6f21d4d commit 8b38e72

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

llama_cpp/_internals.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ def model_desc(self) -> str:
149149
llama_cpp.llama_model_desc(self.model, buf, 256)
150150
return buf.value.decode("utf-8")
151151

152+
def model_ftype(self) -> int:
153+
"""
154+
Get the model file type (quantization), e.g. LLAMA_FTYPE_MOSTLY_Q8_0
155+
"""
156+
return llama_cpp.llama_model_ftype(self.model)
157+
152158
def model_size(self) -> int:
153159
"""
154160
Returns the total size of all the tensors in the model in bytes

llama_cpp/llama_cpp.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,20 @@ class llama_ftype(enum.IntEnum):
408408
LLAMA_FTYPE_MOSTLY_Q1_0 = 40
409409
LLAMA_FTYPE_GUESSED = 1024
410410

411+
# // Get the model file type (quantization) as a string, e.g. "Q8_0" or "Q4_K - Medium"
412+
# LLAMA_API const char * llama_ftype_name(enum llama_ftype ftype);
413+
@ctypes_function(
414+
"llama_ftype_name",
415+
[ctypes.c_int],
416+
ctypes.c_char_p,
417+
)
418+
def llama_ftype_name(
419+
ftype: llama_ftype, /
420+
) -> bytes:
421+
"""
422+
Get the model file type (quantization) as a string, e.g. "Q8_0" or "Q4_K - Medium"
423+
"""
424+
411425
# enum llama_rope_scaling_type {
412426
# LLAMA_ROPE_SCALING_TYPE_UNSPECIFIED = -1,
413427
# LLAMA_ROPE_SCALING_TYPE_NONE = 0,
@@ -1922,6 +1936,21 @@ def llama_model_desc(
19221936
...
19231937

19241938

1939+
# // Get the model file type (quantization), e.g. LLAMA_FTYPE_MOSTLY_Q8_0
1940+
# LLAMA_API enum llama_ftype llama_model_ftype(const struct llama_model * model);
1941+
@ctypes_function(
1942+
"llama_model_ftype",
1943+
[llama_model_p_ctypes],
1944+
ctypes.c_int,
1945+
)
1946+
def llama_model_ftype(
1947+
model: llama_model_p,
1948+
/,
1949+
) -> int:
1950+
"""Get the model file type (quantization), e.g. LLAMA_FTYPE_MOSTLY_Q8_0"""
1951+
...
1952+
1953+
19251954
# // Returns the total size of all the tensors in the model in bytes
19261955
# LLAMA_API uint64_t llama_model_size(const struct llama_model * model);
19271956
@ctypes_function("llama_model_size", [llama_model_p_ctypes], ctypes.c_uint64)

vendor/llama.cpp

Submodule llama.cpp updated 53 files

0 commit comments

Comments
 (0)