@@ -267,8 +267,9 @@ int main(int argc, char ** argv) {
267
267
{
268
268
// inp_system = ::falcon_tokenize(ctx, ">>DOMAIN<<<|prefix_begin|>"+params.system_prompt+"<|prefix_end|>", false);
269
269
// inp_system = ::falcon_tokenize(ctx, "<|prefix_begin|>"+params.system_prompt+"<|prefix_end|>", false);
270
- // inp_system = ::falcon_tokenize(ctx, "<|prompter|>"+params.system_prompt+" Okay?<|endoftext|><|assistant|>Okay<|endoftext|>", false);
271
- inp_system = ::falcon_tokenize (ctx, " >>INTRODUCTION<<" +params.system_prompt +" \n <|endoftext|>" , false );
270
+ // inp_system = ::falcon_tokenize(ctx, "<|prompter|>"+params.system_prompt+" Okay?<|endoftext|><|assistant|>Okay<|endoftext|>", false);
271
+ inp_system = ::falcon_tokenize (ctx, " <|prompter|>" +params.system_prompt +" <|endoftext|>" , false );
272
+ // inp_system = ::falcon_tokenize(ctx, ">>INTRODUCTION<<"+params.system_prompt+"\n<|endoftext|>", false);
272
273
if (!params.sys_prompt_simple )
273
274
{
274
275
// inp_system_baseline = ::falcon_tokenize(ctx, "<|prompter|>"+params.system_baseline_prompt+" Okay?<|endoftext|><|assistant|>Okay<|endoftext|>", false);
@@ -1031,6 +1032,7 @@ fprintf(stderr, "+------------+-------+-------+-------+-------+---------------+-
1031
1032
// get user interactive input
1032
1033
if (n_past >= 0 && is_interacting)
1033
1034
{
1035
+
1034
1036
if (params.instruct ) {
1035
1037
printf (" \n > " );
1036
1038
}
@@ -1051,9 +1053,9 @@ fprintf(stderr, "+------------+-------+-------+-------+-------+---------------+-
1051
1053
// done taking input, reset color
1052
1054
console_set_color (con_st, CONSOLE_COLOR_DEFAULT);
1053
1055
}
1056
+ std::vector<falcon_token> additional_input={};
1054
1057
if (n_past >= 0 && (is_interacting))
1055
1058
{
1056
- std::vector<falcon_token> additional_input={};
1057
1059
// Add tokens to embd only if the input buffer is non-empty
1058
1060
// Entering a empty line lets the user pass control back
1059
1061
if (buffer.length () > 1 ) {
@@ -1073,11 +1075,12 @@ fprintf(stderr, "+------------+-------+-------+-------+-------+---------------+-
1073
1075
additional_input.insert (additional_input.end (), line_inp.begin (), line_inp.end ());
1074
1076
1075
1077
// instruct mode: insert response suffix
1076
- if (params.enclose_finetune ) {
1078
+ if (params.enclose_finetune && !is_antiprompt ) {
1077
1079
additional_input.insert (additional_input.end (), inp_sfx.begin (), inp_sfx.end ());
1078
1080
}
1079
1081
embd_inp.insert (embd_inp.end (), additional_input.begin (), additional_input.end ());
1080
1082
n_remain -= (int )additional_input.size (); // ugh - don't like ignoring the prompts. needs a audit
1083
+ is_interacting = false ;
1081
1084
}
1082
1085
1083
1086
if (additional_input.size ())
@@ -1102,7 +1105,7 @@ fprintf(stderr, "+------------+-------+-------+-------+-------+---------------+-
1102
1105
}
1103
1106
1104
1107
if (n_past >= 0 ) {
1105
- is_interacting = false ;
1108
+ // is_interacting = false;
1106
1109
}
1107
1110
}
1108
1111
#if 0
@@ -1118,8 +1121,8 @@ fprintf(stderr, "+------------+-------+-------+-------+-------+---------------+-
1118
1121
}
1119
1122
#endif
1120
1123
1121
- // end of text token
1122
- if (!embd.empty () && embd.back () == falcon_token_eos () || stopword_fulfilled)
1124
+ // end of text token or stopword detected in generated content
1125
+ if (( !embd.empty () && embd.back () == falcon_token_eos () && n_past > embd_inp. size () ) || stopword_fulfilled)
1123
1126
{
1124
1127
if (params.instruct )
1125
1128
{
0 commit comments