Skip to content

Commit c11a690

Browse files
authored
Merge branch 'main' into hypercorn
2 parents 690aaa1 + f9b7221 commit c11a690

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

llama_cpp/llama.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,12 @@ def __init__(
262262
raise ValueError(f"Value for {k} is too long: {v}")
263263
v_bytes = v_bytes.ljust(128, b"\0")
264264
self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_TYPE_STR
265-
self._kv_overrides_array[i].value.str_value[:128] = v_bytes
265+
# copy min(v_bytes, 128) to str_value
266+
ctypes.memmove(
267+
self._kv_overrides_array[i].value.str_value,
268+
v_bytes,
269+
min(len(v_bytes), 128),
270+
)
266271
else:
267272
raise ValueError(f"Unknown value type for {k}: {v}")
268273

llama_cpp/server/types.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
temperature_field = Field(
2020
default=0.8,
21-
ge=0.0,
22-
le=2.0,
2321
description="Adjust the randomness of the generated text.\n\n"
2422
+ "Temperature is a hyperparameter that controls the randomness of the generated text. It affects the probability distribution of the model's output tokens. A higher temperature (e.g., 1.5) makes the output more random and creative, while a lower temperature (e.g., 0.5) makes the output more focused, deterministic, and conservative. The default value is 0.8, which provides a balance between randomness and determinism. At the extreme, a temperature of 0 will always pick the most likely next token, leading to identical outputs in each run.",
2523
)

0 commit comments

Comments
 (0)