Skip to content

Commit 4c1b7f7

Browse files
committed
Bugfix for logits_processor and stopping_criteria
1 parent 433a2e3 commit 4c1b7f7

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
@@ -358,6 +358,7 @@ def _sample(
358358

359359
if logits_processor is not None:
360360
logits = logits_processor(list(self.eval_tokens), logits)
361+
self.eval_logits[-1] = logits
361362

362363
nl_logit = logits[self._token_nl]
363364
candidates = self._candidates
@@ -855,6 +856,7 @@ def _create_completion(
855856
if stopping_criteria is not None and stopping_criteria(
856857
list(self.eval_tokens), self.eval_logits[-1]
857858
):
859+
text = self.detokenize(completion_tokens)
858860
finish_reason = "stop"
859861

860862
if self.verbose:

0 commit comments

Comments
 (0)