Skip to content

Commit 12bc47a

Browse files
committed
fix: adapt to breaking llama.cpp changes
1 parent 55f5b26 commit 12bc47a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llama/addon/AddonModel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ class AddonModelLoadModelWorker : public Napi::AsyncWorker {
9292

9393
void Execute() {
9494
try {
95-
model->model = llama_load_model_from_file(model->modelPath.c_str(), model->model_params);
95+
model->model = llama_model_load_from_file(model->modelPath.c_str(), model->model_params);
9696

9797
model->modelLoaded = model->model != nullptr && model->model != NULL;
9898
} catch (const std::exception& e) {
9999
SetError(e.what());
100100
} catch(...) {
101-
SetError("Unknown error when calling \"llama_load_model_from_file\"");
101+
SetError("Unknown error when calling \"llama_model_load_from_file\"");
102102
}
103103
}
104104
void OnOK() {
@@ -141,14 +141,14 @@ class AddonModelUnloadModelWorker : public Napi::AsyncWorker {
141141

142142
void Execute() {
143143
try {
144-
llama_free_model(model->model);
144+
llama_model_free(model->model);
145145
model->modelLoaded = false;
146146

147147
model->dispose();
148148
} catch (const std::exception& e) {
149149
SetError(e.what());
150150
} catch(...) {
151-
SetError("Unknown error when calling \"llama_free_model\"");
151+
SetError("Unknown error when calling \"llama_model_free\"");
152152
}
153153
}
154154
void OnOK() {
@@ -359,7 +359,7 @@ void AddonModel::dispose() {
359359
disposed = true;
360360
if (modelLoaded) {
361361
modelLoaded = false;
362-
llama_free_model(model);
362+
llama_model_free(model);
363363

364364
adjustNapiExternalMemorySubtract(Env(), loadedModelSize);
365365
loadedModelSize = 0;

0 commit comments

Comments
 (0)