Skip to content

Commit f5dd2b4

Browse files
author
John
committed
A fix for the instruction mode stopping.
1 parent 4116a3d commit f5dd2b4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

examples/falcon/falcon_main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,8 +1185,9 @@ fprintf(stderr, "+------------+-------+-------+-------+-------+---------------+-
11851185
#endif
11861186

11871187
// end of text token or stopword detected in generated content
1188-
if ((!embd.empty() && embd.back() == falcon_token_eos() && n_past_total > embd_inp.size()) || stopword_fulfilled)
1188+
if ((!embd.empty() && embd.back() == falcon_token_eos() && n_consumed >= embd_inp.size()) || stopword_fulfilled)
11891189
{
1190+
// printf("embd.size(): %d, embd.back(): %d, n_past_total: %d, embd_inp.size(): %d, n_consumed: %d, n_remain: %d\n",embd.size(), embd.back(), n_past_total, embd_inp.size() , n_consumed, n_remain);
11901191
if (params.instruct)
11911192
{
11921193
is_interacting = true;

libfalcon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4554,7 +4554,7 @@ int falcon_eval(
45544554
struct falcon_context * ctx,
45554555
const falcon_token * tokens,
45564556
falcon_evaluation_config &configuration) {
4557-
// fprintf(stderr, "falcon_eval: n_tokens=%d, n_past=%d, n_threads=%d\n", n_tokens, n_past, n_threads);
4557+
// fprintf(stderr, "falcon_eval: n_tokens=%d, n_past=%d, n_threads=%d\n", configuration.n_tokens, configuration.n_past, configuration.n_threads);
45584558
// fprintf(stderr, "n_ctx=%d, n_embd=%d, n_head=%d, n_layer=%d, n_vocab=%d\n", ctx->model.hparams.n_ctx, ctx->model.hparams.n_embd, ctx->model.hparams.n_head, ctx->model.hparams.n_layer, ctx->model.hparams.n_vocab);
45594559
FALCON_ASSERT(ctx->model.hparams.n_ctx >= (configuration.n_past+configuration.n_tokens)); // kv buffer overflow
45604560
#if defined(GGML_USE_CUBLAS)

0 commit comments

Comments
 (0)