Skip to content

examples : switch input_noecho to input_echo to remove negation #979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ int main(int argc, char ** argv) {
}

bool is_antiprompt = false;
bool input_noecho = false;
bool input_echo = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool input_echo = true;
bool input_echo = true;


int n_past = 0;
int n_remain = params.n_predict;
Expand Down Expand Up @@ -340,7 +340,7 @@ int main(int argc, char ** argv) {
embd.push_back(id);

// echo this to console
input_noecho = false;
input_echo = true;

// decrement remaining sampling budget
--n_remain;
Expand All @@ -358,14 +358,14 @@ int main(int argc, char ** argv) {
}

// display text
if (!input_noecho) {
if (input_echo) {
for (auto id : embd) {
printf("%s", llama_token_to_str(ctx, id));
}
fflush(stdout);
}
// reset color to default if we there is no pending user input
if (!input_noecho && (int)embd_inp.size() == n_consumed) {
if (input_echo && (int)embd_inp.size() == n_consumed) {
set_console_color(con_st, CONSOLE_COLOR_DEFAULT);
}

Expand Down Expand Up @@ -460,7 +460,7 @@ int main(int argc, char ** argv) {
n_remain -= line_inp.size();
}

input_noecho = true; // do not echo this again
input_echo = false; // do not echo this again
}

if (n_past > 0) {
Expand Down