mirror of
https://github.com/ollama/ollama.git
synced 2025-08-25 20:51:11 +02:00
Narrow set of paths we load GGML from (#10485)
Users may have other incompatible GGML installs on their systems. This will prevent us from trying to load them from the path.
This commit is contained in:
@@ -57,26 +57,20 @@ var OnceLoad = sync.OnceFunc(func() {
|
||||
exe = "."
|
||||
}
|
||||
|
||||
// PATH, LD_LIBRARY_PATH, and DYLD_LIBRARY_PATH are often
|
||||
// set by the parent process, however, use a default value
|
||||
// if the environment variable is not set.
|
||||
var name, value string
|
||||
var value string
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
// On macOS, DYLD_LIBRARY_PATH is often not set, so
|
||||
// we use the directory of the executable as the default.
|
||||
name = "DYLD_LIBRARY_PATH"
|
||||
value = filepath.Dir(exe)
|
||||
case "windows":
|
||||
name = "PATH"
|
||||
value = filepath.Join(filepath.Dir(exe), "lib", "ollama")
|
||||
default:
|
||||
name = "LD_LIBRARY_PATH"
|
||||
value = filepath.Join(filepath.Dir(exe), "..", "lib", "ollama")
|
||||
}
|
||||
|
||||
paths, ok := os.LookupEnv(name)
|
||||
// Avoid potentially loading incompatible GGML libraries
|
||||
paths, ok := os.LookupEnv("OLLAMA_LIBRARY_PATH")
|
||||
if !ok {
|
||||
slog.Debug("OLLAMA_LIBRARY_PATH not set, falling back to default", "search", value)
|
||||
paths = value
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user