From cf0fdd3691bd82d90cf465dfce96a3fd2382a45f Mon Sep 17 00:00:00 2001 From: luoyao Date: Fri, 22 Nov 2024 20:39:27 +0800 Subject: [PATCH] update --- .../model_benchmark/llm/llama3_benchmark.cpp | 47 +++++++++++++++++++ src/common/status_code.h | 1 + 2 files changed, 48 insertions(+) diff --git a/src/apps/model_benchmark/llm/llama3_benchmark.cpp b/src/apps/model_benchmark/llm/llama3_benchmark.cpp index 3cab73a..0b2b046 100644 --- a/src/apps/model_benchmark/llm/llama3_benchmark.cpp +++ b/src/apps/model_benchmark/llm/llama3_benchmark.cpp @@ -4,3 +4,50 @@ * File: llama3_benchmark.cpp * Date: 24-11-22 ************************************************/ + +// llama3 benchmark + +#include +#include "toml/toml.hpp" + +#include "common/file_path_util.h" +#include "common/time_stamp.h" +#include "models/model_io_define.h" +#include "models/llm/llama/llama3.h" + +using jinq::common::FilePathUtil; +using jinq::common::Timestamp; +using jinq::models::llm::llama::Llama3; + +int main(int argc, char** argv) { + + if (argc != 2 && argc != 3) { + LOG(ERROR) << "wrong usage"; + LOG(INFO) << "exe config_file_path [test_image_path]"; + return -1; + } + + std::string cfg_file_path = argv[1]; + LOG(INFO) << "config file path: " << cfg_file_path; + if (!FilePathUtil::is_file_exist(cfg_file_path)) { + LOG(INFO) << "config file: " << cfg_file_path << " not exist"; + return -1; + } + + // construct llama3 model + Llama3 model; + auto cfg = toml::parse(cfg_file_path); + model.init(cfg); + if (!model.is_successfully_initialized()) { + LOG(INFO) << "llama3 model init failed"; + return -1; + } + + std::string input = "\n" + "Can you recommend some beginner-friendly programming languages for someone new to coding?\n" + ""; + std::string out; + model.run(input, out); + + return 0; +} diff --git a/src/common/status_code.h b/src/common/status_code.h index 68272e6..9338df9 100644 --- a/src/common/status_code.h +++ b/src/common/status_code.h @@ -55,6 +55,7 @@ enum StatusCode { // tokenization failed TOKENIZE_UNKNOWN_TOKEN = 80, + TOKENIZE_FAILED = 81, // trt error TRT_CUDA_ERROR = 90,