common : ignore all EOG tokens

Co-authored-by: Diego Devesa <slarengh@gmail.com>
This commit is contained in:
Georgi Gerganov 2024-12-12 22:50:34 +02:00
parent 97261aa216
commit 1ff9296253
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

View file

@ -941,8 +941,12 @@ struct common_init_result common_init_from_params(common_params & params) {
}
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});
for (llama_token i = 0; i < llama_n_vocab(model); i++) {
if (llama_token_is_eog(model, i)) {
LOG_INF("%s: added %s logit bias = %f\n", __func__, common_token_to_piece(lctx, i).c_str(), -INFINITY);
params.sampling.logit_bias.push_back({i, -INFINITY});
}
}
}
if (params.sampling.penalty_last_n == -1) {