common : apply ignore_eos as logit bias

ggml-ci
This commit is contained in:
Georgi Gerganov 2024-12-12 21:22:33 +02:00
parent 0a1f7fb66d
commit 58a5c3bb0f
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 6 additions and 1 deletions

View file

@ -940,6 +940,11 @@ struct common_init_result common_init_from_params(common_params & params) {
params.sampling.ignore_eos = false; params.sampling.ignore_eos = false;
} }
if (params.sampling.ignore_eos) {
LOG_INF("%s: added EOS logit bias = %f\n", __func__, -INFINITY);
params.sampling.logit_bias.push_back({llama_token_eos(model), -INFINITY});
}
if (params.warmup) { if (params.warmup) {
LOG_WRN("%s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n", __func__); LOG_WRN("%s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n", __func__);

View file

@ -1467,7 +1467,7 @@ struct server_context {
n_ctx = llama_n_ctx(ctx); n_ctx = llama_n_ctx(ctx);
add_bos_token = llama_add_bos_token(model); add_bos_token = llama_add_bos_token(model);
has_eos_token = !llama_add_eos_token(model); has_eos_token = llama_token_eos(model) != LLAMA_TOKEN_NULL;
if (!params_base.speculative.model.empty()) { if (!params_base.speculative.model.empty()) {
SRV_INF("loading draft model '%s'\n", params_base.speculative.model.c_str()); SRV_INF("loading draft model '%s'\n", params_base.speculative.model.c_str());