Skip to content

Commit 87f4adf

Browse files
committed
fix: restore sh -c for llamafile on Linux
Signed-off-by: Rishi Jat <rishijat098@gmail.com>
1 parent 79a426d commit 87f4adf

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

pkg/lib/harness/llm-harness.go

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,31 @@ func (harness *LLMHarness) Start(modelPath string, loraPaths []string) (err erro
9090
}
9191
var cmd *exec.Cmd
9292

93-
args := []string{
94-
"--server",
95-
"--model", modelPath,
96-
"--host", harness.Host,
97-
"--port", fmt.Sprintf("%d", harness.Port),
98-
"--path", uiHome,
99-
"--gpu", "AUTO",
100-
"--nobrowser",
101-
"--unsecure",
102-
}
103-
104-
for _, loraPath := range loraPaths {
105-
args = append(args, "--lora", loraPath)
106-
}
107-
10893
if runtime.GOOS == "windows" {
94+
args := []string{
95+
"--server",
96+
"--model", modelPath,
97+
"--host", harness.Host,
98+
"--port", fmt.Sprintf("%d", harness.Port),
99+
"--path", uiHome,
100+
"--gpu", "AUTO",
101+
"--nobrowser",
102+
"--unsecure",
103+
}
104+
for _, loraPath := range loraPaths {
105+
args = append(args, "--lora", loraPath)
106+
}
109107
cmd = exec.Command("./llamafile.exe", args...)
110108
} else {
111-
cmd = exec.Command("./llamafile", args...)
109+
// Build command string for sh -c (required for APE binaries on Linux)
110+
loraArgs := ""
111+
for _, loraPath := range loraPaths {
112+
loraArgs += fmt.Sprintf(" --lora %s", loraPath)
113+
}
114+
cmd = exec.Command("sh", "-c",
115+
fmt.Sprintf("./llamafile --server --model %s --host %s --port %d --path %s --gpu AUTO --nobrowser --unsecure%s",
116+
modelPath, harness.Host, harness.Port, uiHome, loraArgs),
117+
)
112118
}
113119

114120
cmd.Dir = harnessPath

0 commit comments

Comments
 (0)