Skip to content

Commit 869ec41

Browse files
committed
common : apply ignore_eos as logit bias
ggml-ci
1 parent 0e6fa4a commit 869ec41

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

common/common.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,11 @@ struct common_init_result common_init_from_params(common_params & params) {
940940
params.sampling.ignore_eos = false;
941941
}
942942

943+
if (params.sampling.ignore_eos) {
944+
LOG_INF("%s: added EOS logit bias = %f\n", __func__, -INFINITY);
945+
params.sampling.logit_bias.push_back({llama_token_eos(model), -INFINITY});
946+
}
947+
943948
if (params.warmup) {
944949
LOG_WRN("%s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n", __func__);
945950

examples/server/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ struct server_context {
14671467
n_ctx = llama_n_ctx(ctx);
14681468

14691469
add_bos_token = llama_add_bos_token(model);
1470-
has_eos_token = !llama_add_eos_token(model);
1470+
has_eos_token = llama_token_eos(model) != LLAMA_TOKEN_NULL;
14711471

14721472
if (!params_base.speculative.model.empty()) {
14731473
SRV_INF("loading draft model '%s'\n", params_base.speculative.model.c_str());

0 commit comments

Comments
 (0)