diff --git a/CHANGELOG.md b/CHANGELOG.md index 174eb8a7d..139e9a47c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- fix: size Python buffers to the actual context by @remote-controlled-man in #2436 - feat: update llama.cpp to ggml-org/llama.cpp@afe77e18f - fix(ci): remove unsupported macOS 14 release runners by @abetlen in #2416 diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 14e2f8500..5e8cc6563 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -480,9 +480,10 @@ def free_lora_adapter(): self.n_tokens = 0 # Restored or truncated state must decode before sampling. self._requires_eval = True - self.input_ids: npt.NDArray[np.intc] = np.ndarray((n_ctx,), dtype=np.intc) + self.input_ids: npt.NDArray[np.intc] = np.ndarray((self._n_ctx,), dtype=np.intc) self.scores: npt.NDArray[np.single] = np.ndarray( - (n_ctx if logits_all == True else n_batch, self._n_vocab), dtype=np.single + (self._n_ctx if logits_all == True else n_batch, self._n_vocab), + dtype=np.single, ) self._mirostat_mu = ctypes.c_float(