]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
examples : flush log upon ctrl+c (#9559)
authorGeorgi Gerganov <redacted>
Fri, 20 Sep 2024 08:46:56 +0000 (11:46 +0300)
committerGitHub <redacted>
Fri, 20 Sep 2024 08:46:56 +0000 (11:46 +0300)
examples/infill/infill.cpp
examples/main/main.cpp

index b77b876ccc924c0fa47089a98a97c62f8aabfbad..35607276a8dac112930502e597e5b105a7c0cfaf 100644 (file)
@@ -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);
         }
     }
index 91fea93266c860af8145c5d19082139de24433d7..c3041f1fbc9b3424f48eef936eaee2ae44e8098d 100644 (file)
@@ -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);
         }
     }