Skip to content

Commit

Permalink
fix: unload engine before updating (#1970)
Browse files Browse the repository at this point in the history
Co-authored-by: sangjanai <[email protected]>
  • Loading branch information
vansangpfiev and sangjanai authored Feb 14, 2025
1 parent 257573b commit 0991133
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions engine/controllers/engines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ void Engines::UpdateEngine(
metadata = (*exist_engine).metadata;
}

(void) engine_service_->UnloadEngine(engine);

auto upd_res =
engine_service_->UpsertEngine(engine, type, api_key, url, version,
"all-platforms", status, metadata);
Expand Down
2 changes: 1 addition & 1 deletion engine/services/engine_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -906,10 +906,10 @@ cpp::result<void, std::string> EngineService::UnloadEngine(
auto unload_opts = EngineI::EngineUnloadOption{};
e->Unload(unload_opts);
delete e;
engines_.erase(ne);
} else {
delete std::get<RemoteEngineI*>(engines_[ne].engine);
}
engines_.erase(ne);

CTL_DBG("Engine unloaded: " + ne);
return {};
Expand Down
2 changes: 2 additions & 0 deletions engine/services/model_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,8 @@ cpp::result<std::optional<std::string>, std::string>
ModelService::MayFallbackToCpu(const std::string& model_path, int ngl,
int ctx_len, int n_batch, int n_ubatch,
const std::string& kv_cache_type) {
// TODO(sang) temporary disable this function
return std::nullopt;
assert(hw_service_);
auto hw_info = hw_service_->GetHardwareInfo();
assert(!!engine_svc_);
Expand Down

0 comments on commit 0991133

Please sign in to comment.