Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6d8bc09

Browse filesBrowse files
committed
fix: inccorect bindings for kv override. Based on abetlen#1011
1 parent f4be84c commit 6d8bc09
Copy full SHA for 6d8bc09

File tree

Expand file treeCollapse file tree

1 file changed

+14
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-10
lines changed

‎llama_cpp/llama_cpp.py

Copy file name to clipboardExpand all lines: llama_cpp/llama_cpp.py
+14-10Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
c_int32,
1010
c_uint8,
1111
c_uint32,
12+
c_int64,
1213
c_size_t,
1314
c_float,
1415
c_double,
1516
c_void_p,
1617
POINTER,
1718
_Pointer, # type: ignore
1819
Structure,
20+
Union as CtypesUnion,
1921
Array,
2022
)
2123
import pathlib
@@ -317,12 +319,9 @@ class llama_batch(Structure):
317319
# LLAMA_KV_OVERRIDE_FLOAT,
318320
# LLAMA_KV_OVERRIDE_BOOL,
319321
# };
320-
class llama_model_kv_override_type(Structure):
321-
_fields_ = [
322-
("LLAMA_KV_OVERRIDE_INT", c_int),
323-
("LLAMA_KV_OVERRIDE_FLOAT", c_int),
324-
("LLAMA_KV_OVERRIDE_BOOL", c_int),
325-
]
322+
LLAMA_KV_OVERRIDE_INT = 0
323+
LLAMA_KV_OVERRIDE_FLOAT = 1
324+
LLAMA_KV_OVERRIDE_BOOL = 2
326325

327326
# struct llama_model_kv_override {
328327
# char key[128];
@@ -333,15 +332,20 @@ class llama_model_kv_override_type(Structure):
333332
# bool bool_value;
334333
# };
335334
# };
336-
class llama_model_kv_override(Structure):
335+
class llama_model_kv_override_value(CtypesUnion):
337336
_fields_ = [
338-
("key", ctypes.c_char * 128),
339-
("tag", llama_model_kv_override_type),
340-
("int_value", ctypes.c_int64),
337+
("int_value", c_int64),
341338
("float_value", c_double),
342339
("bool_value", c_bool),
343340
]
344341

342+
class llama_model_kv_override(Structure):
343+
_fields_ = [
344+
("key", ctypes.c_char * 128),
345+
("tag", c_int),
346+
("value", llama_model_kv_override_value),
347+
]
348+
345349
# struct llama_model_params {
346350
# int32_t n_gpu_layers; // number of layers to store in VRAM
347351
# int32_t main_gpu; // the GPU that is used for scratch and small tensors

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.