Skip to content

Commit f11e2a7

Browse files
committed
Fix last_n_tokens_size
1 parent 7e55244 commit f11e2a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llama_cpp/llama.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ def _sample(
295295
assert self.ctx is not None
296296
assert len(self.eval_logits) > 0
297297
n_vocab = int(llama_cpp.llama_n_vocab(self.ctx))
298+
n_ctx = int(llama_cpp.llama_n_ctx(self.ctx))
298299
top_k = llama_cpp.c_int(n_vocab) if top_k.value <= 0 else top_k
300+
last_n_tokens_size = llama_cpp.c_int(n_ctx) if last_n_tokens_size.value < 0 else last_n_tokens_size
299301
logits = self.eval_logits[-1]
300302
data = (llama_cpp.llama_token_data * n_vocab)(
301303
*[

0 commit comments

Comments
 (0)