-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add cmd to start rpc-server from llama.cpp
Signed-off-by: mudler <[email protected]>
- Loading branch information
Showing
4 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cli | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
|
||
"github.com/go-skynet/LocalAI/pkg/assets" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
type LLAMACPPWorkerCMD struct { | ||
Args []string `arg:"" optional:"" name:"models" help:"Worker arguments: host port"` | ||
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"` | ||
} | ||
|
||
func (r *LLAMACPPWorkerCMD) Run(ctx *Context) error { | ||
// Extract files from the embedded FS | ||
err := assets.ExtractFiles(ctx.BackendAssets, r.BackendAssetsPath) | ||
log.Debug().Msgf("Extracting backend assets files to %s", r.BackendAssetsPath) | ||
if err != nil { | ||
log.Warn().Msgf("Failed extracting backend assets files: %s (might be required for some backends to work properly, like gpt4all)", err) | ||
} | ||
|
||
return syscall.Exec( | ||
assets.ResolvePath( | ||
r.BackendAssetsPath, | ||
"util", | ||
"llama-cpp-rpc-server", | ||
), | ||
append([]string{ | ||
assets.ResolvePath( | ||
r.BackendAssetsPath, | ||
"util", | ||
"llama-cpp-rpc-server", | ||
)}, r.Args...), | ||
os.Environ()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters