Skip to content

Commit

Permalink
fix(cuda): workaround sigsegv
Browse files Browse the repository at this point in the history
See: #218

Signed-off-by: mudler <[email protected]>
  • Loading branch information
mudler committed Sep 20, 2023
1 parent b471eb7 commit 6fbdaea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,12 +970,14 @@ gpt_params* create_gpt_params(const std::string& fname,const std::string& lora,c
// Initialize the 'model' member with the 'fname' parameter
lparams->model = fname;
// Temporary workaround for https://github.com/go-skynet/go-llama.cpp/issues/218
#ifndef GGML_USE_CUBLAS
lparams->lora_base = lora_base;
lparams->lora_adapter = lora;
if (lparams->lora_adapter.empty()) {
lparams->use_mmap = false;
}
#endif
return lparams;
}
Expand Down
10 changes: 6 additions & 4 deletions patches/1902-cuda.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/common/common.cpp b/common/common.cpp
index 3138213..af93a32 100644
index d4f9dbf..4edc500 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -1257,3 +1257,83 @@ void dump_non_result_info_yaml(FILE * stream, const gpt_params & params, const l
@@ -1259,3 +1259,85 @@ void dump_non_result_info_yaml(FILE * stream, const gpt_params & params, const l
fprintf(stream, "typical_p: %f # default: 1.0\n", params.typical_p);
fprintf(stream, "verbose_prompt: %s # default: false\n", params.verbose_prompt ? "true" : "false");
}
Expand All @@ -13,12 +13,14 @@ index 3138213..af93a32 100644
+
+ // Initialize the 'model' member with the 'fname' parameter
+ lparams->model = fname;
+// Temporary workaround for https://github.com/go-skynet/go-llama.cpp/issues/218
+#ifndef GGML_USE_CUBLAS
+ lparams->lora_base = lora_base;
+ lparams->lora_adapter = lora;
+ if (lparams->lora_adapter.empty()) {
+ lparams->use_mmap = false;
+ }
+
+#endif
+ return lparams;
+}
+
Expand Down Expand Up @@ -88,7 +90,7 @@ index 3138213..af93a32 100644
+}
\ No newline at end of file
diff --git a/common/common.h b/common/common.h
index 105fb09..8f60434 100644
index 85ac0df..eb9d24b 100644
--- a/common/common.h
+++ b/common/common.h
@@ -201,3 +201,10 @@ std::string get_sortable_timestamp();
Expand Down

0 comments on commit 6fbdaea

Please sign in to comment.