瀏覽代碼

Merge pull request #1781 from dhiltgen/cpu_only_build

Fix CPU only builds
Daniel Hiltgen 1 年之前
父節點
當前提交
c1a10a6e9b
共有 2 個文件被更改,包括 6 次插入3 次删除
  1. 3 0
      llm/llama.cpp/gen_linux.sh
  2. 3 3
      llm/shim_ext_server.go

+ 3 - 0
llm/llama.cpp/gen_linux.sh

@@ -35,6 +35,9 @@ BUILD_DIR="gguf/build/linux/cpu"
 build
 install
 
+# Placeholder to keep go embed happy until we start building dynamic CPU lib variants
+touch ${BUILD_DIR}/lib/dummy.so
+
 if [ -d /usr/local/cuda/lib64/ ]; then
     echo "CUDA libraries detected - building dynamic CUDA library"
     init_vars

+ 3 - 3
llm/shim_ext_server.go

@@ -147,9 +147,9 @@ func extractDynamicLibs(workDir, glob string) ([]string, error) {
 	if err != nil || len(files) == 0 {
 		return nil, payloadMissing
 	}
-	libs := make([]string, len(files))
+	libs := []string{}
 
-	for i, file := range files {
+	for _, file := range files {
 		pathComps := strings.Split(file, "/")
 		if len(pathComps) != 7 {
 			log.Printf("unexpected payload components: %v", pathComps)
@@ -169,7 +169,7 @@ func extractDynamicLibs(workDir, glob string) ([]string, error) {
 
 		destFile := filepath.Join(targetDir, filepath.Base(file))
 		if strings.Contains(destFile, "server") {
-			libs[i] = destFile
+			libs = append(libs, destFile)
 		}
 
 		_, err = os.Stat(destFile)