8000 fix: sample idx off-by-one error for logit_processors (#1179) · thiner/llama-cpp-python@d6be533 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6be533

Browse files
lapp0Andrew Lappabetlen
authored
fix: sample idx off-by-one error for logit_processors (abetlen#1179)
* fix sample_idx off-by-one error * self._scores is indexed differently, only modify the index within self._input_ids --------- Co-authored-by: Andrew Lapp <andrew@rew.la> Co-authored-by: Andrei <abetlen@gmail.com>
1 parent f7cdf78 commit d6be533

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llama_cpp/llama.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def sample(
557557
logits[:] = (
558558
logits_processor(self._input_ids, logits)
559559
if idx is None
560-
else logits_processor(self._input_ids[:idx], logits)
560+
else logits_processor(self._input_ids[:idx + 1], logits)
561561
)
562562

563563
sampling_params = _LlamaSamplingParams(

0 commit comments

Comments
 (0)
0