We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d1eb88 commit e34f441Copy full SHA for e34f441
llama_cpp/llama.py
@@ -443,7 +443,8 @@ def eval(self, tokens: Sequence[int]):
443
# Save logits
444
rows = n_tokens if self.params.logits_all else 1
445
cols = self._n_vocab
446
- self.scores[self.n_tokens : self.n_tokens + n_tokens, :].reshape(-1)[:] = llama_cpp.llama_get_logits(self.ctx)[:rows * cols]
+ offset = 0 if self.params.logits_all else n_tokens - 1 # NOTE: Only save the last token logits if logits_all is False
447
+ self.scores[self.n_tokens + offset: self.n_tokens + n_tokens, :].reshape(-1)[:] = llama_cpp.llama_get_logits(self.ctx)[:rows * cols]
448
# Update n_tokens
449
self.n_tokens += n_tokens
450
0 commit comments