Skip to content

Commit 5ea1285

Browse files
committed
Update llama.cpp API 20260106
1 parent 8a2de86 commit 5ea1285

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

llama_cpp/_internals.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ def n_cls_out(self) -> int:
9292
def n_embd(self) -> int:
9393
return llama_cpp.llama_model_n_embd(self.model)
9494

95+
def n_embd_inp(self) -> int:
96+
return llama_cpp.llama_model_n_embd_inp(self.model)
97+
98+
def n_embd_out(self) -> int:
99+
return llama_cpp.llama_model_n_embd_out(self.model)
100+
101+
def n_layer(self) -> int:
102+
return llama_cpp.llama_model_n_layer(self.model)
103+
95104
def n_head(self) -> int:
96105
return llama_cpp.llama_model_n_head(self.model)
97106

llama_cpp/llama.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,14 +2351,42 @@ def n_ctx(self) -> int:
23512351
"""Return the context window size."""
23522352
return self._ctx.n_ctx()
23532353

2354+
def n_ctx_train(self) -> int:
2355+
"""Return the training context window size."""
2356+
return self._model.n_ctx_train()
2357+
23542358
def n_embd(self) -> int:
23552359
"""Return the embedding size."""
23562360
return self._model.n_embd()
23572361

2362+
def n_embd_inp(self) -> int:
2363+
"""Return the input embedding size."""
2364+
return self._model.n_embd_inp()
2365+
2366+
def n_embd_out(self) -> int:
2367+
"""Return the output embedding size."""
2368+
return self._model.n_embd_out()
2369+
2370+
def n_layer(self) -> int:
2371+
"""Return the n_layer value."""
2372+
return self._model.n_layer()
2373+
2374+
def n_head(self) -> int:
2375+
"""Return the head size."""
2376+
return self._model.n_head()
2377+
23582378
def n_head_kv(self) -> int:
23592379
"""Return the head_kv size."""
23602380
return self._model.n_head_kv()
23612381

2382+
def n_swa(self) -> int:
2383+
"""Return the swa size."""
2384+
return self._model.n_swa()
2385+
2386+
def n_params(self) -> int:
2387+
"""Returns the total number of parameters in the model"""
2388+
return self._model.n_params()
2389+
23622390
def n_vocab(self) -> int:
23632391
"""Return the vocabulary size."""
23642392
return self._model.n_vocab()

llama_cpp/llama_cpp.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,12 @@ def llama_model_n_embd_inp(model: llama_model_p, /) -> int:
15621562
...
15631563

15641564

1565+
# LLAMA_API int32_t llama_model_n_embd_out (const struct llama_model * model);
1566+
@ctypes_function("llama_model_n_embd_out", [llama_model_p_ctypes], ctypes.c_int32)
1567+
def llama_model_n_embd_out(model: llama_model_p, /) -> int:
1568+
...
1569+
1570+
15651571
# LLAMA_API int32_t llama_model_n_layer (const struct llama_model * model);
15661572
@ctypes_function("llama_model_n_layer", [llama_model_p_ctypes], ctypes.c_int32)
15671573
def llama_model_n_layer(model: llama_model_p, /) -> int:

0 commit comments

Comments
 (0)