Skip to content

Commit

Permalink
fix: Fix speculative decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
abetlen committed Sep 26, 2024
1 parent 65222bc commit 9992c50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion llama_cpp/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,10 @@ def sample(
grammar=grammar,
)

ridx = idx - self.n_tokens if idx is not None else -1

assert self.ctx is not None
token = self._sampler.sample(self._ctx, -1)
token = self._sampler.sample(self._ctx, ridx)
if tmp_sampler:
self._sampler = None
return token
Expand Down

0 comments on commit 9992c50

Please sign in to comment.