]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml : allow loading backend with env variable (ggml/1059)
authorRadoslav Gerganov <redacted>
Sun, 5 Jan 2025 07:50:37 +0000 (09:50 +0200)
committerGeorgi Gerganov <redacted>
Wed, 8 Jan 2025 11:40:18 +0000 (13:40 +0200)
ref: #1058

ggml/src/ggml-backend-reg.cpp

index 7ddd178b5f371cc5ebd5905cb3bd6767e3f7f71c..955ed505fa11696e5e102a4709924746b8e6eb3e 100644 (file)
@@ -574,4 +574,9 @@ void ggml_backend_load_all_from_path(const char * dir_path) {
     ggml_backend_load_best("opencl", silent, dir_path);
     ggml_backend_load_best("musa", silent, dir_path);
     ggml_backend_load_best("cpu", silent, dir_path);
+    // check the environment variable GGML_BACKEND_PATH to load an out-of-tree backend
+    const char * backend_path = std::getenv("GGML_BACKEND_PATH");
+    if (backend_path) {
+        ggml_backend_load(backend_path);
+    }
 }