Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

fix: unload engine before updating #1970

Merged
merged 1 commit into from
Feb 14, 2025
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: 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
Loading