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 a14d8a9

Browse filesBrowse files
committed
perf: assign to candidates data structure instead
1 parent ca11673 commit a14d8a9
Copy full SHA for a14d8a9

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
@@ -487,9 +487,9 @@ def _sample(
487487
nl_logit = logits[self._token_nl]
488488
candidates = self._candidates
489489
candidates_data = self._candidates_data
490-
candidates_data["id"] = np.arange(n_vocab, dtype=np.intc) # type: ignore
491-
candidates_data["logit"] = logits
492-
candidates_data["p"] = np.zeros(n_vocab, dtype=np.single)
490+
candidates_data["id"][:] = np.arange(n_vocab, dtype=np.intc) # type: ignore
491+
candidates_data["logit"][:] = logits
492+
candidates_data["p"][:] = np.zeros(n_vocab, dtype=np.single)
493493
candidates.data = candidates_data.ctypes.data_as(llama_cpp.llama_token_data_p)
494494
candidates.sorted = llama_cpp.c_bool(False)
495495
candidates.size = llama_cpp.c_size_t(n_vocab)

0 commit comments

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