From 55c0ee76b4da7221ac22508a4db1fdffd1e93257 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Thu, 13 Feb 2025 22:13:00 -0800 Subject: [PATCH] llm: do not evaluate symlink for exe path lookup (#9088) In some cases, the directories in the executable path read by filepath.EvalSymlinks are not accessible, resulting in permission errors which results in an error when running models. It also doesn't work well on long paths on windows, also resulting in errors. This change removes filepath.EvalSymlinks when accessing os.Executable() altogether --- discover/path.go | 5 ----- llm/server.go | 5 ----- 2 files changed, 10 deletions(-) diff --git a/discover/path.go b/discover/path.go index b6b648dbf..23aa8110d 100644 --- a/discover/path.go +++ b/discover/path.go @@ -19,11 +19,6 @@ var LibOllamaPath string = func() string { return "" } - exe, err = filepath.EvalSymlinks(exe) - if err != nil { - return "" - } - var libPath string switch runtime.GOOS { case "windows": diff --git a/llm/server.go b/llm/server.go index 881209b39..7f5240d98 100644 --- a/llm/server.go +++ b/llm/server.go @@ -320,11 +320,6 @@ func NewLlamaServer(gpus discover.GpuInfoList, model string, ggml *GGML, adapter return nil, fmt.Errorf("unable to lookup executable path: %w", err) } - exe, err = filepath.EvalSymlinks(exe) - if err != nil { - return nil, fmt.Errorf("unable to evaluate symlinks for executable path: %w", err) - } - // TODO - once fully switched to the Go runner, load the model here for tokenize/detokenize cgo access s := &llmServer{ port: port,