Skip to content

Commit

Permalink
XTC: Sorting before resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggotHATE committed Aug 21, 2024
1 parent a4a8d60 commit 363bcbc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions base/llama-addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ void llama_sample_xtc_addon(struct llama_context * ctx, llama_token_data_array *
}
}
}

candidates->sorted = false;
// sorting with new logits
std::sort(candidates->data, candidates->data + candidates->size, [](const llama_token_data & a, const llama_token_data & b) {
return a.logit > b.logit;
});
//resizing now that penalized tokens are at the back
candidates->size = candidates->size - removed;

llama_set_time(ctx, t_start_sample_us);
Expand Down

0 comments on commit 363bcbc

Please sign in to comment.