8000 self._scores is indexed differently, only modify the index within sel… · abetlen/llama-cpp-python@493d6a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 493d6a7

Browse files
author
Andrew Lapp
committed
self._scores is indexed differently, only modify the index within self._input_ids
1 parent a4677ad commit 493d6a7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llama_cpp/llama.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def sample(
553553
logits[:] = (
554554
logits_processor(self._input_ids, logits)
555555
if idx is None
556-
else logits_processor(self._input_ids[:idx], logits)
556+
else logits_processor(self._input_ids[:idx + 1], logits)
557557
)
558558

559559
sampling_params = _LlamaSamplingParams(
@@ -658,7 +658,6 @@ def generate(
658658
while True:
659659
self.eval(tokens)
660660
while sample_idx < self.n_tokens:
661-
next_sample_idx = sample_idx + 1
662661
token = self.sample(
663662
top_k=top_k,
664663
top_p=top_p,
@@ -675,7 +674,7 @@ def generate(
675674
logits_processor=logits_processor,
676675
grammar=grammar,
677676
penalize_nl=penalize_nl,
678-
idx=next_sample_idx,
677+
idx=sample_idx,
679678
)
680679

681680
sample_idx += 1

0 commit comments

Comments
 (0)
0