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 3fc9147

Browse filesBrowse files
authored
Iterate over tokens that should be biased rather than the entire vocabulary. (abetlen#851)
1 parent 9c8f4dc commit 3fc9147
Copy full SHA for 3fc9147

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+3
-4
lines changed

‎llama_cpp/server/app.py

Copy file name to clipboardExpand all lines: llama_cpp/server/app.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,9 @@ def logit_bias_processor(
601601
input_ids: npt.NDArray[np.intc],
602602
scores: npt.NDArray[np.single],
603603
) -> npt.NDArray[np.single]:
604-
new_scores = [None] * len(scores)
605-
for input_id, score in enumerate(scores):
606-
new_scores[input_id] = score + to_bias.get(input_id, 0.0)
607-
604+
new_scores = np.copy(scores) # Does it make sense to copy the whole array or can we just overwrite the original one?
605+
for input_id, score in to_bias.items():
606+
new_scores[input_id] = score + scores[input_id]
608607
return new_scores
609608

610609
return logit_bias_processor

0 commit comments

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