Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update engine list #1183

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cortex-cpp-quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
make package

- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: cortex-cpp-${{ matrix.os }}-${{ matrix.name }}
path: ./engine/cortex-cpp
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
make package

- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: cortex-cpp-${{ matrix.os }}-${{ matrix.name }}
path: ./cortex-cpp/cortex-cpp
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/platform-openai-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
AWS_EC2_METADATA_DISABLED: "true"

- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: report
path: |
Expand Down
7 changes: 3 additions & 4 deletions engine/commands/engine_get_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ void EngineGetCmd::Exec() const {
try {
auto status = engine_service.GetEngineInfo(engine_);
tabulate::Table table;
table.add_row({"name", "description", "version", "product name", "status"});
table.format().font_color(tabulate::Color::green);
table.add_row({status.name, status.description, status.version,
status.product_name, status.status});
table.add_row({"Name", "Supported Formats", "Version", "Status"});
table.add_row(
{status.product_name, status.format, status.version, status.status});
std::cout << table << std::endl;
} catch (const std::runtime_error& e) {
std::cerr << "Engine " << engine_ << " is not supported!" << "\n";
Expand Down
22 changes: 3 additions & 19 deletions engine/commands/engine_list_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,12 @@ bool EngineListCmd::Exec() {
auto status_list = engine_service.GetEngineInfoList();

tabulate::Table table;
table.format().font_color(tabulate::Color::green);
table.add_row(
{"(Index)", "name", "description", "version", "product name", "status"});
table.add_row({"#", "Name", "Supported Formats", "Version", "Status"});
for (int i = 0; i < status_list.size(); i++) {
auto status = status_list[i];
std::string index = std::to_string(i + 1);
table.add_row({index, status.name, status.description, status.version,
status.product_name, status.status});
}

for (int i = 0; i < 6; i++) {
table[0][i]
.format()
.font_color(tabulate::Color::white) // Set font color
.font_style({tabulate::FontStyle::bold})
.font_align(tabulate::FontAlign::center);
}
for (int i = 1; i < 4; i++) {
table[i][0]
.format()
.font_color(tabulate::Color::white) // Set font color
.font_align(tabulate::FontAlign::center);
table.add_row({index, status.product_name, status.format, status.version,
status.status});
}

std::cout << table << std::endl;
Expand Down
37 changes: 22 additions & 15 deletions engine/services/engine_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#include "algorithm"
#include "utils/file_manager_utils.h"

namespace {
constexpr static auto kIncompatible = "Incompatible";
constexpr static auto kReady = "Ready";
constexpr static auto kNotInstalled = "Not Installed";
} // namespace

EngineInfo EngineService::GetEngineInfo(const std::string& engine) const {
// if engine is not found in kSupportEngine, throw runtime error
if (std::find(kSupportEngines.begin(), kSupportEngines.end(), engine) ==
Expand All @@ -21,42 +27,43 @@ EngineInfo EngineService::GetEngineInfo(const std::string& engine) const {
std::vector<EngineInfo> EngineService::GetEngineInfoList() const {
auto ecp = file_manager_utils::GetEnginesContainerPath();

std::string onnx_status{"not_supported"};
std::string llamacpp_status = std::filesystem::exists(ecp / "cortex.llamacpp")
? "ready"
: "not_initialized";
std::string tensorrt_status{"not_supported"};
std::string onnx_status{kIncompatible};
std::string llamacpp_status =
std::filesystem::exists(ecp / "cortex.llamacpp") ? kReady : kNotInstalled;
std::string tensorrt_status{kIncompatible};

#ifdef _WIN32
onnx_status = std::filesystem::exists(ecp / "cortex.onnx")
? "ready"
: "not_initialized";
onnx_status =
std::filesystem::exists(ecp / "cortex.onnx") ? kReady : kNotInstalled;
tensorrt_status = std::filesystem::exists(ecp / "cortex.tensorrt-llm")
? "ready"
: "not_initialized";
? kReady
: kNotInstalled;
#elif defined(__linux__)
tensorrt_status = std::filesystem::exists(ecp / "cortex.tensorrt-llm")
? "ready"
: "not_initialized";
? kReady
: kNotInstalled;
#endif
std::vector<EngineInfo> engines = {
{.name = "cortex.onnx",
.description = "This extension enables chat completion API calls using "
"the Onnx engine",
.format = "ONNX",
.version = "0.0.1",
.product_name = "Onnx Inference Engine",
.product_name = "ONNXRuntime",
.status = onnx_status},
{.name = "cortex.llamacpp",
.description = "This extension enables chat completion API calls using "
"the LlamaCPP engine",
.format = "GGUF",
.version = "0.0.1",
.product_name = "LlamaCPP Inference Engine",
.product_name = "llama.cpp",
.status = llamacpp_status},
{.name = "cortex.tensorrt-llm",
.description = "This extension enables chat completion API calls using "
"the TensorrtLLM engine",
.format = "TensorRT Engines",
.version = "0.0.1",
.product_name = "TensorrtLLM Inference Engine",
.product_name = "TensorRT-LLM",
.status = tensorrt_status},
};

Expand Down
1 change: 1 addition & 0 deletions engine/services/engine_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
struct EngineInfo {
std::string name;
std::string description;
std::string format;
std::string version;
std::string product_name;
std::string status;
Expand Down
Loading