Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04d9218

Browse filesBrowse files
authored
Merge pull request abetlen#420 from samfundev/main
Only concatenate after all batches are done
2 parents b6f9388 + d788fb4 commit 04d9218
Copy full SHA for 04d9218

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎llama_cpp/llama.py

Copy file name to clipboardExpand all lines: llama_cpp/llama.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ def eval(self, tokens: Sequence[int]):
405405
"""
406406
assert self.ctx is not None
407407
n_ctx = self._n_ctx
408+
scores = []
408409
for i in range(0, len(tokens), self.n_batch):
409410
batch = tokens[i : min(len(tokens), i + self.n_batch)]
410411
n_past = min(n_ctx - len(batch), len(self._input_ids))
@@ -430,9 +431,8 @@ def eval(self, tokens: Sequence[int]):
430431
logits_view = llama_cpp.llama_get_logits(self.ctx)
431432
logits = [logits_view[i * cols : (i + 1) * cols] for i in range(rows)]
432433
self.eval_logits.extend(logits)
433-
self._scores: npt.NDArray[np.single] = np.concatenate(
434-
(self._scores, np.array(logits, dtype=np.single)), axis=0
435-
)
434+
scores.append(np.array(logits, dtype=np.single))
435+
self._scores = np.concatenate(scores)
436436

437437
def _sample(
438438
self,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.