From 3d4854455ce1b02d1af52b18e8c964f2118ba793 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Fri, 17 Mar 2023 11:01:02 +0800 Subject: [PATCH] ban eos token --- main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.cpp b/main.cpp index f6e670ef4..2a51bf475 100644 --- a/main.cpp +++ b/main.cpp @@ -950,6 +950,9 @@ int main(int argc, char ** argv) { { const int64_t t_start_sample_us = ggml_time_us(); + // set the logit of the eos token (2) to zero to avoid sampling it + logits[logits.size() - n_vocab + 2] = 0; + id = llama_sample_top_p_top_k(vocab, logits.data() + (logits.size() - n_vocab), last_n_tokens, repeat_penalty, top_k, top_p, temp, rng); last_n_tokens.erase(last_n_tokens.begin());