aboutsummaryrefslogtreecommitdiff
path: root/examples/server/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/server/server.cpp')
-rw-r--r--examples/server/server.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/server/server.cpp b/examples/server/server.cpp
index c0984aa..de22d30 100644
--- a/examples/server/server.cpp
+++ b/examples/server/server.cpp
@@ -115,6 +115,7 @@ struct llama_server_context {
std::vector<llama_token> embd;
std::vector<llama_token> last_n_tokens;
+ llama_model * model = nullptr;
llama_context * ctx = nullptr;
gpt_params params;
@@ -130,6 +131,10 @@ struct llama_server_context {
llama_free(ctx);
ctx = nullptr;
}
+ if (model) {
+ llama_free_model(model);
+ model = nullptr;
+ }
}
void rewind() {
@@ -150,8 +155,8 @@ struct llama_server_context {
bool loadModel(const gpt_params & params_) {
params = params_;
- ctx = llama_init_from_gpt_params(params);
- if (ctx == nullptr) {
+ std::tie(model, ctx) = llama_init_from_gpt_params(params);
+ if (model == nullptr) {
LOG_ERROR("unable to load model", { { "model", params_.model } });
return false;
}