author mode -> multiline input

This commit is contained in:
Danny Daemonic 2023-04-23 07:05:02 -07:00
parent 52e319050b
commit 94dd17247a
3 changed files with 8 additions and 8 deletions

View file

@ -274,10 +274,10 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
params.embedding = true;
} else if (arg == "--interactive-first") {
params.interactive_first = true;
} else if (arg == "--author-mode") {
params.author_mode = true;
} else if (arg == "-ins" || arg == "--instruct") {
params.instruct = true;
} else if (arg == "--multiline-input") {
params.multiline_input = true;
} else if (arg == "--color") {
params.use_color = true;
} else if (arg == "--mlock") {
@ -368,7 +368,7 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
fprintf(stderr, " -i, --interactive run in interactive mode\n");
fprintf(stderr, " --interactive-first run in interactive mode and wait for input right away\n");
fprintf(stderr, " -ins, --instruct run in instruction mode (use with Alpaca models)\n");
fprintf(stderr, " --author-mode allows you to write or paste multiple lines without ending each in '\\'\n");
fprintf(stderr, " --multiline-input allows you to write or paste multiple lines without ending each in '\\'\n");
fprintf(stderr, " -r PROMPT, --reverse-prompt PROMPT\n");
fprintf(stderr, " run in interactive mode and poll user input upon seeing PROMPT (can be\n");
fprintf(stderr, " specified more than once for multiple prompts).\n");
@ -644,7 +644,7 @@ bool console_readline(console_state & con_st, std::string & line) {
}
}
bool has_more = con_st.author_mode;
bool has_more = con_st.multiline_input;
if (is_special_char) {
fputs("\b \b", stdout); // Move cursor back, print a space, and move cursor back again

View file

@ -60,7 +60,7 @@ struct gpt_params {
bool embedding = false; // get only sentence embedding
bool interactive_first = false; // wait for user input immediately
bool author_mode = false; // reverse the usage of `\`
bool multiline_input = false; // reverse the usage of `\`
bool instruct = false; // instruction mode (used for Alpaca models)
bool penalize_nl = true; // consider newlines as a repeatable token
@ -109,7 +109,7 @@ enum console_color_t {
};
struct console_state {
bool author_mode = false;
bool multiline_input = false;
bool use_color = false;
console_color_t color = CONSOLE_COLOR_DEFAULT;
#if !defined (_WIN32)

View file

@ -59,7 +59,7 @@ int main(int argc, char ** argv) {
// save choice to use color for later
// (note for later: this is a slightly awkward choice)
con_st.use_color = params.use_color;
con_st.author_mode = params.author_mode;
con_st.multiline_input = params.multiline_input;
console_init(con_st);
atexit([]() { console_cleanup(con_st); });
@ -275,7 +275,7 @@ int main(int argc, char ** argv) {
if (params.interactive) {
const char *control_message;
if (con_st.author_mode) {
if (con_st.multiline_input) {
control_message = " - To return control to LLaMa, end your input with '\\'.\n"
" - To return control without starting a new line, end your input with '/'.\n";
} else {