Skip to content

Commit

Permalink
Fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoangthuan99 committed Dec 30, 2024
1 parent dc10a21 commit 75625bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions engine/controllers/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void server::FineTuning(
void server::Inference(const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback) {
LOG_TRACE << "Start inference";
auto q = std::make_shared<services::SyncQueue>();
auto q = std::make_shared<SyncQueue>();
auto ir = inference_svc_->HandleInference(q, req->getJsonObject());
LOG_DEBUG << "request: " << req->getJsonObject()->toStyledString();
if (ir.has_error()) {
Expand All @@ -156,7 +156,7 @@ void server::RouteRequest(
std::function<void(const HttpResponsePtr&)>&& callback) {

LOG_TRACE << "Start route request";
auto q = std::make_shared<services::SyncQueue>();
auto q = std::make_shared<SyncQueue>();
auto ir = inference_svc_->HandleRouteRequest(q, req->getJsonObject());
LOG_DEBUG << "request: " << req->getJsonObject()->toStyledString();
if (ir.has_error()) {
Expand Down
15 changes: 7 additions & 8 deletions engine/services/model_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ void ParseGguf(DatabaseService& db_service,
CTL_ERR("Error adding model to modellist: " + result.error());
}
} else {
if (auto m = db_service.GetModelInfo(ggufDownloadItem.id);
m.has_value()) {
if (auto m = db_service.GetModelInfo(ggufDownloadItem.id); m.has_value()) {
auto upd_m = m.value();
upd_m.status = cortex::db::ModelStatus::Downloaded;
if (auto r = db_service.UpdateModelEntry(ggufDownloadItem.id, upd_m);
Expand Down Expand Up @@ -472,7 +471,8 @@ cpp::result<std::string, std::string> ModelService::HandleUrl(
model_size = model_size + item.bytes.value_or(0);
}
auto gguf_download_item = finishedTask.items[0];
ParseGguf(*db_service_, gguf_download_item, author, std::nullopt, model_size);
ParseGguf(*db_service_, gguf_download_item, author, std::nullopt,
model_size);
};

auto result = download_service_->AddDownloadTask(downloadTask, on_finished);
Expand Down Expand Up @@ -653,7 +653,8 @@ cpp::result<std::string, std::string> ModelService::DownloadModelFromCortexso(
}

std::string model_id{name + ":" + branch};
auto on_finished = [this, branch, model_id](const DownloadTask& finishedTask) {
auto on_finished = [this, branch,
model_id](const DownloadTask& finishedTask) {
const DownloadItem* model_yml_item = nullptr;
auto need_parse_gguf = true;

Expand Down Expand Up @@ -824,8 +825,7 @@ cpp::result<StartModelResult, std::string> ModelService::StartModel(
constexpr const int kDefautlContextLength = 8192;
int max_model_context_length = kDefautlContextLength;
Json::Value json_data;

auto model_entry = modellist_handler.GetModelInfo(model_handle);
auto model_entry = db_service_->GetModelInfo(model_handle);
if (model_entry.has_error()) {
CTL_WRN("Error: " + model_entry.error());
return cpp::fail(model_entry.error());
Expand All @@ -842,7 +842,6 @@ cpp::result<StartModelResult, std::string> ModelService::StartModel(
config::PythonModelConfig python_model_config;
python_model_config.ReadFromYaml(


fmu::ToAbsoluteCortexDataPath(
fs::path(model_entry.value().path_to_model_yaml))
.string());
Expand Down Expand Up @@ -1051,7 +1050,7 @@ cpp::result<bool, std::string> ModelService::StopModel(

// Update for python engine
if (engine_name == kPythonEngine) {
auto model_entry = modellist_handler.GetModelInfo(model_handle);
auto model_entry = db_service_->GetModelInfo(model_handle);
config::PythonModelConfig python_model_config;
python_model_config.ReadFromYaml(
fmu::ToAbsoluteCortexDataPath(
Expand Down

0 comments on commit 75625bb

Please sign in to comment.