Skip to content

Commit

Permalink
fix: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
vansangpfiev committed Aug 29, 2024
1 parent 4800004 commit 0e7e1e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions engine/commands/cmd_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ CmdInfo::CmdInfo(std::string model_id) {

void CmdInfo::Parse(std::string model_id) {
if (model_id.find(kDelimiter) == std::string::npos) {
engine = "cortex.llamacpp";
name = std::move(model_id);
engine_name = "cortex.llamacpp";
model_name = std::move(model_id);
branch = "main";
} else {
auto res = split(model_id, kDelimiter);
if (res.size() != 2) {
LOG_ERROR << "model_id does not valid";
return;
} else {
name = std::move(res[0]);
model_name = std::move(res[0]);
branch = std::move(res[1]);
if (branch.find("onnx") != std::string::npos) {
engine = "cortex.onnx";
engine_name = "cortex.onnx";
} else if (branch.find("tensorrt") != std::string::npos) {
engine = "cortex.tensorrt-llm";
engine_name = "cortex.tensorrt-llm";
} else if (branch.find("gguf") != std::string::npos) {
engine = "cortex.llamacpp";
engine_name = "cortex.llamacpp";
} else {
LOG_ERROR << "Not a valid branch name " << branch;
LOG_ERROR << "Not a valid branch model_name " << branch;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions engine/commands/cmd_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace commands {
struct CmdInfo {
explicit CmdInfo(std::string model_id);

std::string engine;
std::string name;
std::string engine_name;
std::string model_name;
std::string branch;

private:
Expand Down
8 changes: 4 additions & 4 deletions engine/commands/run_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ void RunCmd::Exec() {
auto address = host_ + ":" + std::to_string(port_);
CmdInfo ci(model_id_);
std::string model_file =
ci.branch == "main" ? ci.name : ci.name + "-" + ci.branch;
ci.branch == "main" ? ci.model_name : ci.model_name + "-" + ci.branch;
// TODO should we clean all resource if something fails?
// Check if model existed. If not, download it
{
if (!IsModelExisted(model_file)) {
ModelPullCmd model_pull_cmd(ci.name, ci.branch);
ModelPullCmd model_pull_cmd(ci.model_name, ci.branch);
if (!model_pull_cmd.Exec()) {
return;
}
Expand All @@ -32,8 +32,8 @@ void RunCmd::Exec() {

// Check if engine existed. If not, download it
{
if (!IsEngineExisted(ci.engine)) {
EngineInitCmd eic(ci.engine, "");
if (!IsEngineExisted(ci.engine_name)) {
EngineInitCmd eic(ci.engine_name, "");
if (!eic.Exec())
return;
}
Expand Down
2 changes: 1 addition & 1 deletion engine/controllers/command_line_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {

model_pull_cmd->callback([&model_id]() {
commands::CmdInfo ci(model_id);
commands::ModelPullCmd command(ci.name, ci.branch);
commands::ModelPullCmd command(ci.model_name, ci.branch);
command.Exec();
});

Expand Down

0 comments on commit 0e7e1e0

Please sign in to comment.