Skip to content

Commit

Permalink
examples : flush log upon ctrl+c (#9559)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov authored Sep 20, 2024
1 parent 722ec1e commit d39e267
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/infill/infill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ static void sigint_handler(int signo) {
LOG("\n");
gpt_perf_print(*g_ctx, *g_smpl);
write_logfile(*g_ctx, *g_params, *g_model, *g_input_tokens, g_output_ss->str(), *g_output_tokens);

// make sure all logs are flushed
LOG("Interrupted by user\n");
gpt_log_pause(gpt_log_main());

_exit(130);
}
}
Expand Down
5 changes: 5 additions & 0 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ static void sigint_handler(int signo) {
LOG("\n");
gpt_perf_print(*g_ctx, *g_smpl);
write_logfile(*g_ctx, *g_params, *g_model, *g_input_tokens, g_output_ss->str(), *g_output_tokens);

// make sure all logs are flushed
LOG("Interrupted by user\n");
gpt_log_pause(gpt_log_main());

_exit(130);
}
}
Expand Down

0 comments on commit d39e267

Please sign in to comment.