go-skynet / go-llama.cpp

LLama.cpp golang bindings
MIT License
658 stars 80 forks source link

Binding Change #142

Open jrideout opened 1 year ago

jrideout commented 1 year ago

I had to make the follow change to the types to get successful compilation:

diff --git a/binding.cpp b/binding.cpp
index aef2e8e..eea635d 100644
--- a/binding.cpp
+++ b/binding.cpp
@@ -631,11 +631,11 @@ void* load_model(const char *fname, int n_ctx, int n_seed, bool memory_f16, bool
     void* res = nullptr;
     try {

-        struct llama_model * model = llama_load_model_from_file(fname, &lparams);
+        struct llama_model * model = llama_load_model_from_file(fname, lparams);
         if (!model) {
             return nullptr;
         }
-        struct llama_context * ctx = llama_new_context_with_model(model, &lparams);
+        struct llama_context * ctx = llama_new_context_with_model(model, lparams);
         res = ctx;
     } catch(std::runtime_error& e) {
         fprintf(stderr, "failed %s",e.what());
@@ -643,4 +643,4 @@ void* load_model(const char *fname, int n_ctx, int n_seed, bool memory_f16, bool
     }

     return res;
-}

I can create a PR if this is desired.