Skip to content

Commit d3956ae

Browse files
authored
main : escape prompt for cfg_negative_prompt and consecutive inputs in main with interactive (#3623)
* infill tokens correction * serverinfill tokens correction * removing any leading whitespace from infill suffix and removing leeading space token from suffix when params.escape * removing any leading whitespace from infill suffix and removing leeading space token from suffix when params.escape * only rm when params.escape, rm space if possible which is added back or rm added space token * only rm when params.escape, rm space if possible which is added back or rm added space token * Revert "only rm when params.escape, rm space if possible which is added back or rm added space token" This reverts commit 63ba0b6. * fix interactive prompt escaping and fix server infill leading space handling * rm unnecessary bool check * process escapes for neg prompt and interactive consec prompts * removed unneccessary static string escape
1 parent 22c69a2 commit d3956ae

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

common/common.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
632632
process_escapes(params.prompt);
633633
process_escapes(params.input_prefix);
634634
process_escapes(params.input_suffix);
635+
process_escapes(sparams.cfg_negative_prompt);
635636
for (auto & antiprompt : params.antiprompt) {
636637
process_escapes(antiprompt);
637638
}

examples/main/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,9 @@ int main(int argc, char ** argv) {
761761
n_consumed = embd_inp.size();
762762
embd_inp.insert(embd_inp.end(), inp_pfx.begin(), inp_pfx.end());
763763
}
764+
if (params.escape) {
765+
process_escapes(buffer);
766+
}
764767

765768
const auto line_pfx = ::llama_tokenize(ctx, params.input_prefix, false, true);
766769
const auto line_inp = ::llama_tokenize(ctx, buffer, false, false);

0 commit comments

Comments
 (0)