8000 Add bindings for custom_rope · Keeyahto/llama-cpp-python@3f8f276 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f8f276

Browse files
committed
Add bindings for custom_rope
1 parent 8e0f625 commit 3f8f276

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

llama_cpp/llama.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ def __init__(
205205
model_path: str,
206206
# NOTE: These parameters are likely to change in the future.
207207
n_ctx: int = 512,
208+
rope_freq_base: float = 10000.0,
209+
rope_freq_scale: float = 1.0,
208210
n_parts: int = -1,
209211
n_gpu_layers: int = 0,
210212
seed: int = 1337,
@@ -227,6 +229,8 @@ def __init__(
227229
Args:
228230
model_path: Path to the model.
229231
n_ctx: Maximum context size.
232+
rope_freq_base: RoPE base frequency.
233+
rope_freq_scale: RoPE frequency scale.
230234
n_parts: Number of parts to split the model into. If -1, the number of parts is automatically determined.
231235
seed: Random seed. -1 for random.
232236
f16_kv: Use half-precision for key/value cache.
@@ -253,6 +257,8 @@ def __init__(
253257

254258
self.params = llama_cpp.llama_context_default_params()
255259
self.params.n_ctx = n_ctx
260+
self.params.rope_freq_base = rope_freq_base
261+
self.params.rope_freq_scale = rope_freq_scale
256262
self.params.n_gpu_layers = n_gpu_layers
257263
self.params.seed = seed
258264
self.params.f16_kv = f16_kv

llama_cpp/llama_cpp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ class llama_context_params(Structure):
184184
_fields_ = [
185185
("seed", c_uint32),
186186
("n_ctx", c_int32),
187+
("rope_freq_base", c_float),
188+
("rope_freq_scale", c_float),
187189
("n_batch", c_int32),
188190
("n_gpu_layers", c_int32),
189191
("main_gpu", c_int32),

vendor/llama.cpp

0 commit comments

Comments
 (0)
0