forked from mudler/LocalAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: makefile & updates (mudler#23)
Co-authored-by: mudler <[email protected]> Co-authored-by: Ettore Di Giacinto <[email protected]>
- Loading branch information
1 parent
e8eab66
commit c371752
Showing
10 changed files
with
105 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
models/*.bin | ||
models |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
THREADS=14 | ||
THREADS=14 | ||
CONTEXT_SIZE=700 | ||
MODELS_PATH=/models |
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# go-llama build artifacts | ||
go-llama | ||
|
||
# llama-cli build binary | ||
llama-cli | ||
models/*.bin | ||
|
||
# Ignore models | ||
models/*.bin | ||
models/ggml-* |
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,16 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
|
||
{ | ||
"name": "Launch Go", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "${workspaceFolder}/main.go", | ||
"args": [ | ||
"api" | ||
] | ||
} | ||
] | ||
} |
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,52 @@ | ||
GOCMD=go | ||
GOTEST=$(GOCMD) test | ||
GOVET=$(GOCMD) vet | ||
BINARY_NAME=llama-cli | ||
GOLLAMA_VERSION?=llama.cpp-8b67998 | ||
|
||
GREEN := $(shell tput -Txterm setaf 2) | ||
YELLOW := $(shell tput -Txterm setaf 3) | ||
WHITE := $(shell tput -Txterm setaf 7) | ||
CYAN := $(shell tput -Txterm setaf 6) | ||
RESET := $(shell tput -Txterm sgr0) | ||
|
||
.PHONY: all test build vendor | ||
|
||
all: help | ||
|
||
## Build: | ||
|
||
build: prepare ## Build the project | ||
$(GOCMD) build -o $(BINARY_NAME) ./ | ||
|
||
go-llama: | ||
git clone -b $(GOLLAMA_VERSION) --recurse-submodules https://github.com/go-skynet/go-llama.cpp go-llama | ||
|
||
prepare: go-llama | ||
$(MAKE) -C go-llama libbinding.a | ||
$(GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp=$(shell pwd)/go-llama | ||
|
||
clean: ## Remove build related file | ||
$(MAKE) -C go-llama clean | ||
rm -fr ./go-llama | ||
rm -f $(BINARY_NAME) | ||
|
||
## Run: | ||
run: prepare | ||
C_INCLUDE_PATH=$(shell pwd)/go-llama.cpp LIBRARY_PATH=$(shell pwd)/go-llama.cpp $(GOCMD) run ./ api | ||
|
||
## Test: | ||
test: ## Run the tests of the project | ||
$(GOTEST) -v -race ./... $(OUTPUT_OPTIONS) | ||
|
||
## Help: | ||
help: ## Show this help. | ||
@echo '' | ||
@echo 'Usage:' | ||
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}' | ||
@echo '' | ||
@echo 'Targets:' | ||
@awk 'BEGIN {FS = ":.*?## "} { \ | ||
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \ | ||
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \ | ||
}' $(MAKEFILE_LIST) |
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 |
---|---|---|
@@ -1,15 +1,28 @@ | ||
version: '3.6' | ||
|
||
services: | ||
|
||
# chatgpt: | ||
# image: ghcr.io/mckaywrigley/chatbot-ui:main | ||
# # platform: linux/amd64 | ||
# ports: | ||
# - 3000:3000 | ||
# environment: | ||
# - 'OPENAI_API_KEY=sk-000000000000000' | ||
# - 'OPENAI_API_HOST=http://api:8080' | ||
|
||
api: | ||
image: quay.io/go-skynet/llama-cli:latest | ||
build: . | ||
volumes: | ||
- ./models:/models | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- 8080:8080 | ||
environment: | ||
- MODELS_PATH=/models | ||
- CONTEXT_SIZE=700 | ||
- MODELS_PATH=$MODELS_PATH | ||
- CONTEXT_SIZE=$CONTEXT_SIZE | ||
- THREADS=$THREADS | ||
command: api | ||
volumes: | ||
- ./models:/models:cached | ||
command: api | ||
|
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