Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeShewill-CV committed Nov 22, 2024
1 parent 6801144 commit cf0fdd3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/apps/model_benchmark/llm/llama3_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,50 @@
* File: llama3_benchmark.cpp
* Date: 24-11-22
************************************************/

// llama3 benchmark

#include <glog/logging.h>
#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<std::string, std::string> 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 = "<user>\n"
"Can you recommend some beginner-friendly programming languages for someone new to coding?\n"
"</user>";
std::string out;
model.run(input, out);

return 0;
}
1 change: 1 addition & 0 deletions src/common/status_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum StatusCode {

// tokenization failed
TOKENIZE_UNKNOWN_TOKEN = 80,
TOKENIZE_FAILED = 81,

// trt error
TRT_CUDA_ERROR = 90,
Expand Down

0 comments on commit cf0fdd3

Please sign in to comment.