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

Feat/python engine #1784

Open
wants to merge 40 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
21cde00
chore: add document
namchuai Dec 1, 2024
bd1bf91
feat: update engine interface
namchuai Dec 2, 2024
08fbb8a
chore: add document
namchuai Dec 1, 2024
7d9cf3b
feat: update engine interface
namchuai Dec 2, 2024
3548342
Feat: init python engine
nguyenhoangthuan99 Dec 10, 2024
8486533
Merge branch 'j/engine-improvement' into feat/python-engine
nguyenhoangthuan99 Dec 10, 2024
6958db8
Fix: conflict
nguyenhoangthuan99 Dec 10, 2024
ff2c02d
feat: add python engine implementation
nguyenhoangthuan99 Dec 11, 2024
52d8105
Merge branch 'dev' into feat/python-engine
nguyenhoangthuan99 Dec 11, 2024
accec0a
Fix: CI build window
nguyenhoangthuan99 Dec 11, 2024
e0f75ad
Merge branch 'feat/python-engine' of github.com:janhq/cortex.cpp into…
nguyenhoangthuan99 Dec 11, 2024
6a8bebf
Fix: CI build window
nguyenhoangthuan99 Dec 11, 2024
36f29bf
feat: support download python model from cortexso
nguyenhoangthuan99 Dec 12, 2024
6e3965c
Merge branch 'dev' into feat/python-engine
nguyenhoangthuan99 Dec 12, 2024
10d53a1
feat: add inference interface
nguyenhoangthuan99 Dec 12, 2024
389dd88
feat: integrate to cortex cpp
nguyenhoangthuan99 Dec 14, 2024
d15351f
Merge branch 'dev' into feat/python-engine
nguyenhoangthuan99 Dec 14, 2024
860c2c3
merge dev
nguyenhoangthuan99 Dec 14, 2024
e6324c2
fix: remove pythone engine load engine option
nguyenhoangthuan99 Dec 16, 2024
8bdca01
Merge branch 'feat/python-engine' of github.com:janhq/cortex.cpp into…
nguyenhoangthuan99 Dec 16, 2024
3838a36
Feat: init environment interface
nguyenhoangthuan99 Dec 16, 2024
34237d6
feat: move virtual environment inside model
nguyenhoangthuan99 Dec 17, 2024
56a4f74
Merge branch 'dev' into feat/python-engine
nguyenhoangthuan99 Dec 18, 2024
7ce7eb7
Update CMakeLists.txt
nguyenhoangthuan99 Dec 18, 2024
c2b1118
Update CMakeLists.txt
nguyenhoangthuan99 Dec 18, 2024
7f9ded0
fix: CI build
nguyenhoangthuan99 Dec 18, 2024
27d5097
fix: move log of python to cortex logs folder
nguyenhoangthuan99 Dec 19, 2024
f95cfef
fix: unitest for remote engine because change location of template re…
nguyenhoangthuan99 Dec 19, 2024
2ea032b
fix: CI build windows
nguyenhoangthuan99 Dec 19, 2024
5959980
fix: CI build windows
nguyenhoangthuan99 Dec 19, 2024
0139bbd
Merge branch 'dev' of github.com:janhq/cortex.cpp into feat/python-en…
nguyenhoangthuan99 Dec 19, 2024
09b56ad
feat: add depends model.yml for python engine
nguyenhoangthuan99 Dec 23, 2024
b4c9bb4
Merge branch 'dev' into feat/python-engine
nguyenhoangthuan99 Dec 23, 2024
30b6ae1
Merge branch 'feat/python-engine' of github.com:janhq/cortex.cpp into…
nguyenhoangthuan99 Dec 23, 2024
4fb3688
fix: CI build
nguyenhoangthuan99 Dec 23, 2024
2c7756f
Merge branch 'dev' into feat/python-engine
nguyenhoangthuan99 Dec 26, 2024
2bcedf6
update set permission api
nguyenhoangthuan99 Dec 26, 2024
7694e40
Merge branch 'feat/python-engine' of github.com:janhq/cortex.cpp into…
nguyenhoangthuan99 Dec 26, 2024
4b9e6dc
Fix: comment
nguyenhoangthuan99 Dec 27, 2024
8d1080c
Merge branch 'dev' into feat/python-engine
nguyenhoangthuan99 Dec 27, 2024
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
7 changes: 6 additions & 1 deletion engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,14 @@ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/cortex_openapi.h"
add_executable(${TARGET_NAME} main.cc
${CMAKE_CURRENT_SOURCE_DIR}/utils/cpuid/cpu_info.cc
${CMAKE_CURRENT_SOURCE_DIR}/utils/file_logger.cc

${CMAKE_CURRENT_SOURCE_DIR}/extensions/template_renderer.cc
${CMAKE_CURRENT_SOURCE_DIR}/extensions/python-engine/python_engine.cc

${CMAKE_CURRENT_SOURCE_DIR}/utils/dylib_path_manager.cc

${CMAKE_CURRENT_SOURCE_DIR}/extensions/remote-engine/remote_engine.cc
${CMAKE_CURRENT_SOURCE_DIR}/extensions/remote-engine/template_renderer.cc

)

target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
Expand Down
5 changes: 4 additions & 1 deletion engine/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ add_executable(${TARGET_NAME} main.cc
${CMAKE_CURRENT_SOURCE_DIR}/../services/inference_service.cc
${CMAKE_CURRENT_SOURCE_DIR}/../services/hardware_service.cc
${CMAKE_CURRENT_SOURCE_DIR}/../extensions/remote-engine/remote_engine.cc
${CMAKE_CURRENT_SOURCE_DIR}/../extensions/remote-engine/template_renderer.cc

${CMAKE_CURRENT_SOURCE_DIR}/../extensions/python-engine/python_engine.cc
${CMAKE_CURRENT_SOURCE_DIR}/../extensions/template_renderer.cc

${CMAKE_CURRENT_SOURCE_DIR}/utils/easywsclient.cc
${CMAKE_CURRENT_SOURCE_DIR}/utils/download_progress.cc
${CMAKE_CURRENT_SOURCE_DIR}/../utils/config_yaml_utils.cc
Expand Down
13 changes: 13 additions & 0 deletions engine/common/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,16 @@ class BaseEmbedding {

// The derived class can also override other methods if needed
};

class BasePythonModel {
public:
virtual ~BasePythonModel() {}

// Model management
virtual void Inference(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback) = 0;
virtual void RouteRequest(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback) = 0;
};
13 changes: 12 additions & 1 deletion engine/common/download_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
#include <sstream>
#include <string>

enum class DownloadType { Model, Engine, Miscellaneous, CudaToolkit, Cortex };
enum class DownloadType {
Model,
Engine,
Miscellaneous,
CudaToolkit,
Cortex,
Environments
};

struct DownloadItem {

Expand Down Expand Up @@ -48,6 +55,8 @@ inline std::string DownloadTypeToString(DownloadType type) {
return "CudaToolkit";
case DownloadType::Cortex:
return "Cortex";
case DownloadType::Environments:
return "Environments";
default:
return "Unknown";
}
Expand All @@ -64,6 +73,8 @@ inline DownloadType DownloadTypeFromString(const std::string& str) {
return DownloadType::CudaToolkit;
} else if (str == "Cortex") {
return DownloadType::Cortex;
} else if (str == "Environments") {
return DownloadType::Environments;
} else {
return DownloadType::Miscellaneous;
}
Expand Down
Loading