Change properties to functions to match token functions

This commit is contained in:
Andrei Betlen 2023-05-20 08:24:06 -04:00
parent a7ba85834f
commit 76b1d2cd20

View file

@ -1291,19 +1291,16 @@ class Llama:
if llama_cpp.llama_set_state_data(self.ctx, state.llama_state) != state_size: if llama_cpp.llama_set_state_data(self.ctx, state.llama_state) != state_size:
raise RuntimeError("Failed to set llama state data") raise RuntimeError("Failed to set llama state data")
@property
def n_ctx(self) -> int: def n_ctx(self) -> int:
"""Return the context window size.""" """Return the context window size."""
assert self.ctx is not None assert self.ctx is not None
return llama_cpp.llama_n_ctx(self.ctx) return llama_cpp.llama_n_ctx(self.ctx)
@property
def n_embd(self) -> int: def n_embd(self) -> int:
"""Return the embedding size.""" """Return the embedding size."""
assert self.ctx is not None assert self.ctx is not None
return llama_cpp.llama_n_embd(self.ctx) return llama_cpp.llama_n_embd(self.ctx)
@property
def n_vocab(self) -> int: def n_vocab(self) -> int:
"""Return the vocabulary size.""" """Return the vocabulary size."""
assert self.ctx is not None assert self.ctx is not None