Skip to content

Commit f8754ba

Browse files
ggerganovslaren
andauthored
common : ignore all EOG tokens
Co-authored-by: Diego Devesa <[email protected]>
1 parent 3f82215 commit f8754ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

common/common.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,12 @@ struct common_init_result common_init_from_params(common_params & params) {
941941
}
942942

943943
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});
944+
for (llama_token i = 0; i < llama_n_vocab(model); i++) {
945+
if (llama_token_is_eog(model, i)) {
946+
LOG_INF("%s: added %s logit bias = %f\n", __func__, common_token_to_piece(lctx, i).c_str(), -INFINITY);
947+
params.sampling.logit_bias.push_back({i, -INFINITY});
948+
}
949+
}
946950
}
947951

948952
if (params.sampling.penalty_last_n == -1) {

0 commit comments

Comments
 (0)