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 cfd698c

Browse filesBrowse files
authored
Update low_level_api_llama_cpp.py to match current API (abetlen#1023)
1 parent 095c650 commit cfd698c
Copy full SHA for cfd698c

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+7
-7
lines changed

‎examples/low_level_api/low_level_api_llama_cpp.py

Copy file name to clipboardExpand all lines: examples/low_level_api/low_level_api_llama_cpp.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
embd = []
7474
if len(embd_inp) <= input_consumed:
7575
logits = llama_cpp.llama_get_logits(ctx)
76-
n_vocab = llama_cpp.llama_n_vocab(ctx)
76+
n_vocab = llama_cpp.llama_n_vocab(model)
7777

7878
_arr = (llama_cpp.llama_token_data * n_vocab)(*[
7979
llama_cpp.llama_token_data(token_id, logits[token_id], 0.0)
@@ -83,12 +83,12 @@
8383
llama_cpp.llama_token_data_array(_arr, len(_arr), False))
8484

8585
_arr = (llama_cpp.c_int * len(last_n_tokens_data))(*last_n_tokens_data)
86-
llama_cpp.llama_sample_repetition_penalty(ctx, candidates_p,
86+
llama_cpp.llama_sample_repetition_penalties(ctx, candidates_p,
8787
_arr,
88-
last_n_repeat, repeat_penalty)
89-
llama_cpp.llama_sample_frequency_and_presence_penalties(ctx, candidates_p,
90-
_arr,
91-
last_n_repeat, frequency_penalty, presence_penalty)
88+
penalty_last_n=last_n_repeat,
89+
penalty_repeat=repeat_penalty,
90+
penalty_freq=frequency_penalty,
91+
penalty_present=presence_penalty)
9292

9393
llama_cpp.llama_sample_top_k(ctx, candidates_p, k=40, min_keep=1)
9494
llama_cpp.llama_sample_top_p(ctx, candidates_p, p=0.8, min_keep=1)
@@ -126,4 +126,4 @@
126126

127127
llama_cpp.llama_print_timings(ctx)
128128

129-
llama_cpp.llama_free(ctx)
129+
llama_cpp.llama_free(ctx)

0 commit comments

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