fix: Use memmove to copy str_value kv_override. Closes #1417
This commit is contained in:
parent
0a454bebe6
commit
9f7a85571a
1 changed files with 6 additions and 1 deletions
|
@ -262,7 +262,12 @@ class Llama:
|
|||
raise ValueError(f"Value for {k} is too long: {v}")
|
||||
v_bytes = v_bytes.ljust(128, b"\0")
|
||||
self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_TYPE_STR
|
||||
self._kv_overrides_array[i].value.str_value[:128] = v_bytes
|
||||
# copy min(v_bytes, 128) to str_value
|
||||
ctypes.memmove(
|
||||
self._kv_overrides_array[i].value.str_value,
|
||||
v_bytes,
|
||||
min(len(v_bytes), 128),
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"Unknown value type for {k}: {v}")
|
||||
|
||||
|
|
Loading…
Reference in a new issue