Skip to content

Commit

Permalink
chore(cli): be consistent between workers and expose ExtraLLamaCPPArg…
Browse files Browse the repository at this point in the history
…s to both

Signed-off-by: Ettore Di Giacinto <[email protected]>
  • Loading branch information
mudler committed Aug 29, 2024
1 parent 12950ca commit f8248b2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/cli/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package worker

type WorkerFlags struct {
BackendAssetsPath string `env:"LOCALAI_BACKEND_ASSETS_PATH,BACKEND_ASSETS_PATH" type:"path" default:"/tmp/localai/backend_data" help:"Path used to extract libraries that are required by some of the backends in runtime" group:"storage"`
ExtraLLamaCPPArgs string `name:"llama-cpp-args" env:"LOCALAI_EXTRA_LLAMA_CPP_ARGS,EXTRA_LLAMA_CPP_ARGS" help:"Extra arguments to pass to llama-cpp-rpc-server"`
}

type Worker struct {
Expand Down
4 changes: 3 additions & 1 deletion core/cli/worker/worker_llamacpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package worker
import (
"fmt"
"os"
"strings"
"syscall"

cliContext "github.com/mudler/LocalAI/core/cli/context"
Expand Down Expand Up @@ -36,8 +37,9 @@ func (r *LLamaCPP) Run(ctx *cliContext.Context) error {

args := os.Args[4:]
args, grpcProcess = library.LoadLDSO(r.BackendAssetsPath, args, grpcProcess)

args = append([]string{grpcProcess}, args...)
extraArgs := strings.Split(r.ExtraLLamaCPPArgs, " ")
args = append(args, extraArgs...)
return syscall.Exec(
grpcProcess,
args,
Expand Down
1 change: 0 additions & 1 deletion core/cli/worker/worker_p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type P2P struct {
NoRunner bool `env:"LOCALAI_NO_RUNNER,NO_RUNNER" help:"Do not start the llama-cpp-rpc-server"`
RunnerAddress string `env:"LOCALAI_RUNNER_ADDRESS,RUNNER_ADDRESS" help:"Address of the llama-cpp-rpc-server"`
RunnerPort string `env:"LOCALAI_RUNNER_PORT,RUNNER_PORT" help:"Port of the llama-cpp-rpc-server"`
ExtraLLamaCPPArgs string `name:"llama-cpp-args" env:"LOCALAI_EXTRA_LLAMA_CPP_ARGS,EXTRA_LLAMA_CPP_ARGS" help:"Extra arguments to pass to llama-cpp-rpc-server"`
Peer2PeerNetworkID string `env:"LOCALAI_P2P_NETWORK_ID,P2P_NETWORK_ID" help:"Network ID for P2P mode, can be set arbitrarly by the user for grouping a set of instances" group:"p2p"`
}

Expand Down

0 comments on commit f8248b2

Please sign in to comment.