Skip to content

Commit c0d5530

Browse files
fix: size Python buffers to the actual context (#2436)
* fix: size Python buffers to the actual context * test: cover rounded contexts with prompt lookup * docs: link context buffer fix to PR 2436 * test: remove context buffer regression test from PR --------- Co-authored-by: abetlen <abetlen@gmail.com>
1 parent 98c25a5 commit c0d5530

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- fix: size Python buffers to the actual context by @remote-controlled-man in #2436
1011
- feat: update llama.cpp to ggml-org/llama.cpp@afe77e18f
1112
- fix(ci): remove unsupported macOS 14 release runners by @abetlen in #2416
1213

‎llama_cpp/llama.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,10 @@ def free_lora_adapter():
480480
self.n_tokens = 0
481481
# Restored or truncated state must decode before sampling.
482482
self._requires_eval = True
483-
self.input_ids: npt.NDArray[np.intc] = np.ndarray((n_ctx,), dtype=np.intc)
483+
self.input_ids: npt.NDArray[np.intc] = np.ndarray((self._n_ctx,), dtype=np.intc)
484484
self.scores: npt.NDArray[np.single] = np.ndarray(
485-
(n_ctx if logits_all == True else n_batch, self._n_vocab), dtype=np.single
485+
(self._n_ctx if logits_all == True else n_batch, self._n_vocab),
486+
dtype=np.single,
486487
)
487488

488489
self._mirostat_mu = ctypes.c_float(

0 commit comments

Comments
 (0)