Skip to content

Commit fa056fe

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

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
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;

kernels/quantized/cpu/op_embedding.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ void check_embedding_byte_args(
5454
if (weight_scales.dim() == 2) {
5555
auto num_groups = weight_scales.size(1);
5656
auto remainder = weight.size(1) % num_groups;
57-
#if 0 // handle a partial last group
5857
ET_CHECK_MSG(
5958
remainder == 0,
6059
"Number of groups must divide weight.size(1)=%zd"
6160
", but got # of groups = %zd",
6261
weight.size(1),
6362
num_groups);
64-
#endif // handle a partial last group
6563
}
6664
}
6765

0 commit comments

Comments
 (0)