From 88527f7709cf2e303bc82da08a2481db5b0e466a Mon Sep 17 00:00:00 2001 From: Aaron Po Date: Sat, 18 Apr 2026 18:10:38 -0400 Subject: [PATCH] make prompt formatter unique ptr --- .../includes/data_generation/llama_generator.h | 2 +- pipeline/src/main.cc | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pipeline/includes/data_generation/llama_generator.h b/pipeline/includes/data_generation/llama_generator.h index 53d322f..07da334 100644 --- a/pipeline/includes/data_generation/llama_generator.h +++ b/pipeline/includes/data_generation/llama_generator.h @@ -135,7 +135,7 @@ class LlamaGenerator final : public DataGenerator { std::mt19937 rng_; uint32_t n_ctx_ = kDefaultContextSize; std::string brewery_system_prompt_; - std::shared_ptr prompt_formatter_; + std::unique_ptr prompt_formatter_; }; #endif // BIERGARTEN_PIPELINE_INCLUDES_DATA_GENERATION_LLAMA_GENERATOR_H_ diff --git a/pipeline/src/main.cc b/pipeline/src/main.cc index 024318b..896eb14 100644 --- a/pipeline/src/main.cc +++ b/pipeline/src/main.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -131,8 +132,19 @@ std::optional ParseArguments(const int argc, char** argv) { } } +struct Timer { + std::chrono::steady_clock::time_point start_time = + std::chrono::steady_clock::now(); + [[nodiscard]] int64_t Elapsed() const { + return std::chrono::duration_cast( + std::chrono::steady_clock::now() - start_time) + .count(); + } +}; + int main(const int argc, char** argv) { try { + Timer timer; const CurlGlobalState curl_state; const LlamaBackendState llama_backend_state; spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] %v"); @@ -173,7 +185,7 @@ int main(const int argc, char** argv) { return 1; } - spdlog::info("Pipeline executed successfully"); + spdlog::info("Pipeline executed successfully in {} ms", timer.Elapsed()); return 0; } catch (const std::exception& exception) { spdlog::critical("Unhandled fatal error in main: {}", exception.what());