![Daniel Hiltgen](/assets/img/avatar_default.png)
This reduces the built-in linux version to not use any vector extensions which enables the resulting builds to run under Rosetta on MacOS in Docker. Then at runtime it checks for the actual CPU vector extensions and loads the best CPU library available
24 lines
462 B
Go
24 lines
462 B
Go
package llm
|
|
|
|
import (
|
|
"embed"
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
//go:embed llama.cpp/build/*/*/lib/*.so
|
|
var libEmbed embed.FS
|
|
|
|
func updatePath(dir string) {
|
|
pathComponents := strings.Split(os.Getenv("LD_LIBRARY_PATH"), ":")
|
|
for _, comp := range pathComponents {
|
|
if comp == dir {
|
|
return
|
|
}
|
|
}
|
|
newPath := strings.Join(append([]string{dir}, pathComponents...), ":")
|
|
log.Printf("Updating LD_LIBRARY_PATH to %s", newPath)
|
|
os.Setenv("LD_LIBRARY_PATH", newPath)
|
|
}
|