mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-02-26 08:04:09 +00:00
adaptive p: collect probability before logit bias (#1314)
This commit is contained in:
@@ -424,7 +424,6 @@ static llama_token llama_sampling_sample_impl(
|
||||
id = llama_sample_token_mirostat_v2(ctx_main, &cur_p, mirostat_tau, mirostat_eta, &ctx_sampling->mirostat_mu);
|
||||
} else if (adaptive_target >= 0.0f && ctx_sampling->adapt_p_ctx!=nullptr) {
|
||||
// adaptive p sampling
|
||||
llama_prep_adaptive_p(ctx_main, &cur_p, ctx_sampling->adapt_p_ctx);
|
||||
sampler_queue(ctx_main, params, ctx_sampling, cur_p, std::max(1, params.min_keep));
|
||||
id = llama_sample_token_adaptive_p(ctx_main, &cur_p, ctx_sampling->adapt_p_ctx);
|
||||
} else {
|
||||
@@ -496,6 +495,11 @@ static llama_token_data_array llama_sampling_prepare_impl(
|
||||
*original_logits = {logits, logits + n_vocab};
|
||||
}
|
||||
|
||||
if ((params.temp > 0) && (params.mirostat == 0) && (params.adaptive_target >= 0) && (ctx_sampling->adapt_p_ctx != nullptr)) {
|
||||
// collect original probability before logit bias is applied
|
||||
llama_prep_adaptive_p(ctx_main, logits, ctx_sampling->adapt_p_ctx);
|
||||
}
|
||||
|
||||
// apply params.logit_bias map
|
||||
for (auto it = params.logit_bias.begin(); it != params.logit_bias.end(); it++) {
|
||||
logits[it->first] += it->second;
|
||||
|
||||
Reference in New Issue
Block a user