Skip to content

Commit b317368

Browse files
committed
token healing : change argument order
1 parent ea4abc9 commit b317368

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

common/sampling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ static llama_token_healing_output llama_token_healing_get_prefix(
128128

129129
llama_token_healing_output llama_token_healing_rollback(
130130
const llama_context * ctx_main,
131-
llama_token_healing_type th_type,
132131
std::vector<llama_token> & tokens,
132+
llama_token_healing_type th_type,
133133
int max_to_remove) {
134134
// NB. To avoid returning empty `tokens`, at least 1 token will remain in `tokens` after rolling back.
135135
// It is the caller's responsibility to add BOS to the start of the prompt if they want to roll back the whole prompt.

common/sampling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ struct llama_token_healing_output {
189189
// Call `llama_token_healing_set_prefix` with the returned prefix before the first sampling.
190190
llama_token_healing_output llama_token_healing_rollback(
191191
const llama_context * ctx_main,
192-
llama_token_healing_type th_type,
193192
std::vector<llama_token> & tokens,
193+
llama_token_healing_type th_type,
194194
int max_to_remove = -1);
195195

196196
void llama_token_healing_set_prefix(llama_sampling_context * ctx_sampling, const std::string & prefix);

examples/main/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ int main(int argc, char ** argv) {
297297
}
298298
llama_token_healing_output token_healing_out{};
299299
if (!params.interactive_first && sparams.token_healing.enabled) {
300-
token_healing_out = llama_token_healing_rollback(ctx, sparams.token_healing.type, embd_inp,
301-
sparams.token_healing.n_rollback);
300+
token_healing_out = llama_token_healing_rollback(ctx, embd_inp,
301+
sparams.token_healing.type, sparams.token_healing.n_rollback);
302302
}
303303

304304
// Should not run without any tokens
@@ -962,7 +962,7 @@ int main(int argc, char ** argv) {
962962
const int max_to_remove = sparams.token_healing.n_rollback < 0
963963
? n_new_tokens
964964
: std::min(sparams.token_healing.n_rollback, n_new_tokens);
965-
token_healing_out = llama_token_healing_rollback(ctx, sparams.token_healing.type, embd_inp, max_to_remove);
965+
token_healing_out = llama_token_healing_rollback(ctx, embd_inp, sparams.token_healing.type, max_to_remove);
966966
n_bytes_to_skip = token_healing_out.prefix.size();
967967
}
968968

examples/server/server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,8 +2100,8 @@ struct server_context {
21002100

21012101
if (slot.sparams.token_healing.enabled) {
21022102
// For FIM roll back only the prefix part (i.e. cursor location)
2103-
token_healing_out = llama_token_healing_rollback(ctx, slot.sparams.token_healing.type,
2104-
prefix_tokens, slot.sparams.token_healing.n_rollback);
2103+
token_healing_out = llama_token_healing_rollback(ctx, prefix_tokens,
2104+
slot.sparams.token_healing.type, slot.sparams.token_healing.n_rollback);
21052105
}
21062106

21072107
auto embd_inp = params.spm_infill ? suffix_tokens : prefix_tokens;
@@ -2121,8 +2121,8 @@ struct server_context {
21212121
prompt_tokens = tokenize(slot.prompt, system_prompt.empty()); // add BOS if there isn't system prompt
21222122

21232123
if (slot.sparams.token_healing.enabled) {
2124-
token_healing_out = llama_token_healing_rollback(ctx, slot.sparams.token_healing.type,
2125-
prompt_tokens, slot.sparams.token_healing.n_rollback);
2124+
token_healing_out = llama_token_healing_rollback(ctx, prompt_tokens,
2125+
slot.sparams.token_healing.type, slot.sparams.token_healing.n_rollback);
21262126
}
21272127
}
21282128

0 commit comments

Comments
 (0)