From d3f5fbef6c2825bb49f1f166def3b9fe5195d403 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 21 Aug 2023 19:52:51 +0300 Subject: [PATCH] main : flush stdout --- examples/main/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 8a87b534b..5f69042d8 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -725,8 +725,8 @@ int main(int argc, char ** argv) { is_interacting = true; printf("\n"); - console::set_display(console::user_input); fflush(stdout); + console::set_display(console::user_input); } else if (params.instruct) { is_interacting = true; } @@ -735,6 +735,7 @@ int main(int argc, char ** argv) { if (n_past > 0 && is_interacting) { if (params.instruct) { printf("\n> "); + fflush(stdout); } if (params.input_prefix_bos) { @@ -745,6 +746,7 @@ int main(int argc, char ** argv) { if (!params.input_prefix.empty()) { buffer += params.input_prefix; printf("%s", buffer.c_str()); + fflush(stdout); } std::string line; @@ -764,6 +766,7 @@ int main(int argc, char ** argv) { if (!params.input_suffix.empty()) { buffer += params.input_suffix; printf("%s", params.input_suffix.c_str()); + fflush(stdout); } // instruct mode: insert instruction prefix