Skip to content

Commit 1d416bb

Browse files
Michael Gschwindfacebook-github-bot
authored andcommitted
Stop after first EOS post-promptfor FS2 (#2255)
Summary: Pull Request resolved: #2255 Stop after first EOS post-promptfor FS2 Reviewed By: shoumikhin Differential Revision: D54525365
1 parent 18d803a commit 1d416bb

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

examples/models/llama2/runner/runner.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ Error Runner::generate(
197197
int next; // will store the next token in the sequence
198198
int64_t pos = num_prompt_tokens - 1; // position in the sequence
199199
int token = prompt_tokens[pos]; // prefill starts from 0 to num_prompt_tokens
200-
int eos_counter = 0; // counter to capture EOS
201200
int logits_index = 0; // index of the logits tensor in the output
202201
int k_cache_index = 0;
203202
int v_cache_index = 0;
@@ -340,13 +339,8 @@ Error Runner::generate(
340339

341340
// data-dependent terminating condition: we have n_eos_ number of EOS
342341
if (pos >= num_prompt_tokens && next == eos_id_) {
343-
eos_counter++;
344-
if (eos_counter == n_eos_) {
345-
ET_LOG(Info, "Reached to the end of generation");
346-
break;
347-
}
348-
} else {
349-
eos_counter = 0;
342+
ET_LOG(Info, "Reached to the end of generation");
343+
break;
350344
}
351345

352346
token = next;

0 commit comments

Comments
 (0)