Skip to content

Commit 05420db

Browse files
fix logging in examples/main/main.cpp
LOG() outputs to stdout. This interferes with the generated output in at least 3 places: When we log: "[end of text]", "saving final output to session file", and when we log "\n\n" in line 927. LOG_INF() outputs to stderr. If we use LOG_INF() we can fix that.
1 parent dca1d4b commit 05420db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/main/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ int main(int argc, char ** argv) {
907907

908908
// end of generation
909909
if (!embd.empty() && llama_token_is_eog(model, embd.back()) && !(params.interactive)) {
910-
LOG(" [end of text]\n");
910+
LOG_INF(" [end of text]\n");
911911
break;
912912
}
913913

@@ -920,11 +920,11 @@ int main(int argc, char ** argv) {
920920
}
921921

922922
if (!path_session.empty() && params.prompt_cache_all && !params.prompt_cache_ro) {
923-
LOG("\n%s: saving final output to session file '%s'\n", __func__, path_session.c_str());
923+
LOG_INF("\n%s: saving final output to session file '%s'\n", __func__, path_session.c_str());
924924
llama_state_save_file(ctx, path_session.c_str(), session_tokens.data(), session_tokens.size());
925925
}
926926

927-
LOG("\n\n");
927+
LOG_INF("\n\n");
928928
gpt_perf_print(ctx, smpl);
929929
write_logfile(ctx, params, model, input_tokens, output_ss.str(), output_tokens);
930930

0 commit comments

Comments
 (0)