Skip to content

Commit d0572f4

Browse files
committed
Merge branch 'custom_rope' into main
2 parents f72b6e9 + f0797a6 commit d0572f4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
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,
@@ -228,6 +230,8 @@ def __init__(
228230
Args:
229231
model_path: Path to the model.
230232
n_ctx: Maximum context size.
233+
rope_freq_base: RoPE base frequency.
234+
rope_freq_scale: RoPE frequency scale.
231235
n_parts: Number of parts to split the model into. If -1, the number of parts is automatically determined.
232236
seed: Random seed. -1 for random.
233237
f16_kv: Use half-precision for key/value cache.
@@ -256,6 +260,8 @@ def __init__(
256260

257261
self.params = llama_cpp.llama_context_default_params()
258262
self.params.n_ctx = n_ctx
263+
self.params.rope_freq_base = rope_freq_base
264+
self.params.rope_freq_scale = rope_freq_scale
259265
self.params.n_gpu_layers = n_gpu_layers
260266
self.params.seed = seed
261267
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
@@ -188,6 +188,8 @@ class llama_context_params(Structure):
188188
_fields_ = [
189189
("seed", c_uint32),
190190
("n_ctx", c_int32),
191+
("rope_freq_base", c_float),
192+
("rope_freq_scale", c_float),
191193
("n_batch", c_int32),
192194
("n_gpu_layers", c_int32),
193195
("main_gpu", c_int32),

0 commit comments

Comments
 (0)