2023-04-15 16:39:07 -07:00
GOCMD = go
GOTEST = $( GOCMD) test
GOVET = $( GOCMD) vet
2023-04-19 18:43:10 +02:00
BINARY_NAME = local-ai
2023-05-04 12:26:59 +02:00
2023-07-04 19:02:02 +02:00
# llama.cpp versions
2023-10-22 08:55:44 +02:00
GOLLAMA_VERSION ?= aeba71ee842819da681ea537e78846dc75949ac0
2023-07-04 19:02:02 +02:00
2023-08-20 16:35:42 +02:00
GOLLAMA_STABLE_VERSION ?= 50cee7712066d9e38306eccadcfbb44ea87df4b7
2023-12-05 15:44:24 +01:00
CPPLLAMA_VERSION ?= 23b5e12eb5a76489b4c3ee22213a081da68b1809
2023-10-16 21:46:29 +02:00
2023-07-04 19:02:02 +02:00
# gpt4all version
2023-06-14 18:07:05 +02:00
GPT4ALL_REPO ?= https://github.com/nomic-ai/gpt4all
2023-08-25 01:19:48 +02:00
GPT4ALL_VERSION ?= 27a8b020c36b0df8f8b82a252d261cda47cf44b8
2023-07-04 19:02:02 +02:00
# go-ggml-transformers version
2023-07-16 09:57:16 +02:00
GOGGMLTRANSFORMERS_VERSION ?= ffb09d7dd71e2cbc6c5d7d05357d230eea6f369a
2023-07-04 19:02:02 +02:00
# go-rwkv version
2023-06-04 17:25:35 +02:00
RWKV_REPO ?= https://github.com/donomii/go-rwkv.cpp
2023-07-15 22:52:45 +02:00
RWKV_VERSION ?= c898cd0f62df8f2a7830e53d1d513bef4f6f792b
2023-07-04 19:02:02 +02:00
# whisper.cpp version
2023-12-09 09:23:40 +01:00
WHISPER_CPP_VERSION ?= 885b5563d0e3465a45f27d4b59f1e00a4335b0d9
2023-07-04 19:02:02 +02:00
# bert.cpp version
2023-07-17 23:58:25 +02:00
BERT_VERSION ?= 6abe312cded14042f6b7c3cd8edf082713334a4d
2023-07-04 19:02:02 +02:00
# go-piper version
2023-12-10 08:50:26 +01:00
PIPER_VERSION ?= 6e687b16e88f9451c2ece5b8ff3627ecf54c4a68
2023-07-04 19:02:02 +02:00
# stablediffusion version
2023-11-18 08:18:43 +01:00
STABLEDIFFUSION_VERSION ?= 902db5f066fd137697e3b69d0fa10d4782bd2c2f
2023-07-04 19:02:02 +02:00
2023-06-05 14:26:20 +02:00
export BUILD_TYPE ?=
2023-09-28 12:42:20 -07:00
export STABLE_BUILD_TYPE ?= $( BUILD_TYPE)
2023-09-08 18:38:22 +02:00
export CMAKE_ARGS ?=
2023-05-16 16:26:25 +02:00
CGO_LDFLAGS ?=
CUDA_LIBPATH ?= /usr/local/cuda/lib64/
2023-05-16 19:32:53 +02:00
GO_TAGS ?=
2023-05-23 17:12:48 +02:00
BUILD_ID ?= git
2023-06-26 15:12:43 +02:00
2023-10-19 13:50:40 +02:00
TEST_DIR = /tmp/test
RANDOM := $( shell bash -c 'echo $$RANDOM' )
2023-07-02 11:14:09 +02:00
VERSION ?= $( shell git describe --always --tags || echo "dev" )
2023-06-26 15:12:43 +02:00
# go tool nm ./local-ai | grep Commit
2023-06-22 17:53:10 +02:00
LD_FLAGS ?=
2023-06-26 15:12:43 +02:00
o v e r r i d e LD_FLAGS += -X " github.com/go-skynet/LocalAI/internal.Version= $( VERSION) "
o v e r r i d e LD_FLAGS += -X " github.com/go-skynet/LocalAI/internal.Commit= $( shell git rev-parse HEAD) "
2023-05-16 19:32:53 +02:00
OPTIONAL_TARGETS ?=
2023-05-03 11:45:22 +02:00
2023-05-23 17:12:48 +02:00
OS := $( shell uname -s)
ARCH := $( shell uname -m)
2023-04-15 16:39:07 -07:00
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)
2023-10-19 13:50:40 +02:00
# Default Docker bridge IP
E2E_BRIDGE_IP ?= 172.17.0.1
2023-07-15 01:19:43 +02:00
i f n d e f U N A M E _ S
UNAME_S := $( shell uname -s)
e n d i f
2023-11-30 13:50:50 -05:00
i f e q ( $( OS ) , D a r w i n )
2023-09-05 01:11:28 +08:00
CGO_LDFLAGS += -lcblas -framework Accelerate
2023-11-30 13:50:50 -05:00
ifeq ( $( OSX_SIGNING_IDENTITY) ,)
OSX_SIGNING_IDENTITY := $( shell security find-identity -v -p codesigning | grep '"' | head -n 1 | sed -E 's/.*"(.*)"/\1/' )
endif
# on OSX, if BUILD_TYPE is blank, we should default to use Metal
ifeq ( $( BUILD_TYPE) ,)
BUILD_TYPE = metal
# disable metal if on Darwin and any other value is explicitly passed.
else ifneq ( $( BUILD_TYPE) ,metal)
CMAKE_ARGS += -DLLAMA_METAL= OFF
endif
2023-07-15 01:19:43 +02:00
e n d i f
2023-05-16 16:26:25 +02:00
i f e q ( $( BUILD_TYPE ) , o p e n b l a s )
CGO_LDFLAGS += -lopenblas
2023-12-02 10:10:18 +00:00
export WHISPER_OPENBLAS = 1
2023-04-21 15:29:32 -07:00
e n d i f
2023-05-16 16:26:25 +02:00
i f e q ( $( BUILD_TYPE ) , c u b l a s )
CGO_LDFLAGS += -lcublas -lcudart -L$( CUDA_LIBPATH)
2023-05-19 17:11:28 +02:00
export LLAMA_CUBLAS = 1
2023-12-02 10:10:18 +00:00
export WHISPER_CUBLAS = 1
2023-04-21 15:29:32 -07:00
e n d i f
2023-09-28 12:42:20 -07:00
i f e q ( $( BUILD_TYPE ) , h i p b l a s )
ROCM_HOME ?= /opt/rocm
export CXX = $( ROCM_HOME) /llvm/bin/clang++
export CC = $( ROCM_HOME) /llvm/bin/clang
2023-11-18 08:18:43 +01:00
# llama-ggml has no hipblas support, so override it here.
2023-09-28 12:42:20 -07:00
export STABLE_BUILD_TYPE =
2023-12-02 10:10:18 +00:00
export WHISPER_HIPBLAS = 1
2023-09-28 12:42:20 -07:00
GPU_TARGETS ?= gfx900,gfx90a,gfx1030,gfx1031,gfx1100
AMDGPU_TARGETS ?= " $( GPU_TARGETS) "
CMAKE_ARGS += -DLLAMA_HIPBLAS= ON -DAMDGPU_TARGETS= " $( AMDGPU_TARGETS) " -DGPU_TARGETS= " $( GPU_TARGETS) "
CGO_LDFLAGS += -O3 --rtlib= compiler-rt -unwindlib= libgcc -lhipblas -lrocblas --hip-link
e n d i f
2023-06-05 14:26:20 +02:00
i f e q ( $( BUILD_TYPE ) , m e t a l )
CGO_LDFLAGS += -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders
export LLAMA_METAL = 1
2023-12-02 10:10:18 +00:00
export WHISPER_METAL = 1
2023-06-05 14:26:20 +02:00
e n d i f
2023-05-29 15:17:38 +02:00
i f e q ( $( BUILD_TYPE ) , c l b l a s )
CGO_LDFLAGS += -lOpenCL -lclblast
2023-12-02 10:10:18 +00:00
export WHISPER_CLBLAST = 1
2023-05-29 15:17:38 +02:00
e n d i f
2023-05-24 16:42:24 +02:00
# glibc-static or glibc-devel-static required
i f e q ( $( STATIC ) , t r u e )
LD_FLAGS = -linkmode external -extldflags -static
e n d i f
2023-06-22 17:53:10 +02:00
i f e q ( $( findstring stablediffusion ,$ ( GO_TAGS ) ) , s t a b l e d i f f u s i o n )
2023-07-15 01:19:43 +02:00
# OPTIONAL_TARGETS+=go-stable-diffusion/libstablediffusion.a
2023-07-15 01:19:43 +02:00
OPTIONAL_GRPC += backend-assets/grpc/stablediffusion
2023-05-16 19:32:53 +02:00
e n d i f
2023-06-22 17:53:10 +02:00
i f e q ( $( findstring tts ,$ ( GO_TAGS ) ) , t t s )
2023-07-15 01:19:43 +02:00
# OPTIONAL_TARGETS+=go-piper/libpiper_binding.a
# OPTIONAL_TARGETS+=backend-assets/espeak-ng-data
2023-11-18 08:18:43 +01:00
PIPER_CGO_CXXFLAGS += -I$( shell pwd ) /sources/go-piper/piper/src/cpp -I$( shell pwd ) /sources/go-piper/piper/build/fi/include -I$( shell pwd ) /sources/go-piper/piper/build/pi/include -I$( shell pwd ) /sources/go-piper/piper/build/si/include
2023-11-28 20:55:09 +01:00
PIPER_CGO_LDFLAGS += -L$( shell pwd ) /sources/go-piper/piper/build/fi/lib -L$( shell pwd ) /sources/go-piper/piper/build/pi/lib -L$( shell pwd ) /sources/go-piper/piper/build/si/lib -lfmt -lspdlog -lucd
2023-07-15 01:19:43 +02:00
OPTIONAL_GRPC += backend-assets/grpc/piper
2023-06-22 17:53:10 +02:00
e n d i f
2023-11-18 08:18:43 +01:00
ALL_GRPC_BACKENDS = backend-assets/grpc/langchain-huggingface backend-assets/grpc/falcon-ggml backend-assets/grpc/bert-embeddings backend-assets/grpc/llama backend-assets/grpc/llama-cpp backend-assets/grpc/llama-ggml backend-assets/grpc/gpt4all backend-assets/grpc/dolly backend-assets/grpc/gpt2 backend-assets/grpc/gptj backend-assets/grpc/gptneox backend-assets/grpc/mpt backend-assets/grpc/replit backend-assets/grpc/starcoder backend-assets/grpc/rwkv backend-assets/grpc/whisper $( OPTIONAL_GRPC)
2023-10-21 11:34:59 +02:00
GRPC_BACKENDS ?= $( ALL_GRPC_BACKENDS) $( OPTIONAL_GRPC)
# If empty, then we build all
i f e q ( $( GRPC_BACKENDS ) , )
GRPC_BACKENDS = $( ALL_GRPC_BACKENDS)
e n d i f
2023-08-13 20:04:08 +02:00
2023-04-15 16:39:07 -07:00
.PHONY : all test build vendor
all : help
2023-05-11 14:31:19 +02:00
## GPT4ALL
2023-11-18 08:18:43 +01:00
sources/gpt4all :
git clone --recurse-submodules $( GPT4ALL_REPO) sources/gpt4all
cd sources/gpt4all && git checkout -b build $( GPT4ALL_VERSION) && git submodule update --init --recursive --depth 1
2023-06-01 23:38:52 +02:00
2023-06-22 17:53:10 +02:00
## go-piper
2023-11-18 08:18:43 +01:00
sources/go-piper :
git clone --recurse-submodules https://github.com/mudler/go-piper sources/go-piper
cd sources/go-piper && git checkout -b build $( PIPER_VERSION) && git submodule update --init --recursive --depth 1
2023-04-19 17:10:29 +02:00
2023-05-10 15:20:21 +02:00
## BERT embeddings
2023-11-18 08:18:43 +01:00
sources/go-bert :
git clone --recurse-submodules https://github.com/go-skynet/go-bert.cpp sources/go-bert
cd sources/go-bert && git checkout -b build $( BERT_VERSION) && git submodule update --init --recursive --depth 1
2023-05-10 15:20:21 +02:00
2023-05-16 19:32:53 +02:00
## stable diffusion
2023-11-18 08:18:43 +01:00
sources/go-stable-diffusion :
git clone --recurse-submodules https://github.com/mudler/go-stable-diffusion sources/go-stable-diffusion
cd sources/go-stable-diffusion && git checkout -b build $( STABLEDIFFUSION_VERSION) && git submodule update --init --recursive --depth 1
2023-05-16 19:32:53 +02:00
2023-11-18 08:18:43 +01:00
sources/go-stable-diffusion/libstablediffusion.a :
$( MAKE) -C sources/go-stable-diffusion libstablediffusion.a
2023-05-16 19:32:53 +02:00
2023-05-03 11:45:22 +02:00
## RWKV
2023-11-18 08:18:43 +01:00
sources/go-rwkv :
git clone --recurse-submodules $( RWKV_REPO) sources/go-rwkv
cd sources/go-rwkv && git checkout -b build $( RWKV_VERSION) && git submodule update --init --recursive --depth 1
2023-05-03 11:45:22 +02:00
2023-11-18 08:18:43 +01:00
sources/go-rwkv/librwkv.a : sources /go -rwkv
cd sources/go-rwkv && cd rwkv.cpp && cmake . -DRWKV_BUILD_SHARED_LIBRARY= OFF && cmake --build . && cp librwkv.a ..
2023-05-03 11:45:22 +02:00
2023-11-18 08:18:43 +01:00
sources/go-bert/libgobert.a : sources /go -bert
$( MAKE) -C sources/go-bert libgobert.a
2023-05-10 15:20:21 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/gpt4all : sources /gpt 4all /gpt 4all -bindings /golang /libgpt 4all .a
2023-06-01 23:38:52 +02:00
mkdir -p backend-assets/gpt4all
2023-11-18 08:18:43 +01:00
@cp sources/gpt4all/gpt4all-bindings/golang/buildllm/*.so backend-assets/gpt4all/ || true
@cp sources/gpt4all/gpt4all-bindings/golang/buildllm/*.dylib backend-assets/gpt4all/ || true
@cp sources/gpt4all/gpt4all-bindings/golang/buildllm/*.dll backend-assets/gpt4all/ || true
2023-06-01 23:38:52 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/espeak-ng-data : sources /go -piper
2023-06-22 17:53:10 +02:00
mkdir -p backend-assets/espeak-ng-data
2023-11-18 08:18:43 +01:00
$( MAKE) -C sources/go-piper piper.o
2023-12-07 22:58:41 +01:00
@cp -rf sources/go-piper/piper-phonemize/pi/share/espeak-ng-data/. backend-assets/espeak-ng-data
2023-06-22 17:53:10 +02:00
2023-11-18 08:18:43 +01:00
sources/gpt4all/gpt4all-bindings/golang/libgpt4all.a : sources /gpt 4all
$( MAKE) -C sources/gpt4all/gpt4all-bindings/golang/ libgpt4all.a
2023-04-15 16:39:07 -07:00
2023-05-03 11:45:22 +02:00
## CEREBRAS GPT
2023-11-18 08:18:43 +01:00
sources/go-ggml-transformers :
git clone --recurse-submodules https://github.com/go-skynet/go-ggml-transformers.cpp sources/go-ggml-transformers
cd sources/go-ggml-transformers && git checkout -b build $( GOGPT2_VERSION) && git submodule update --init --recursive --depth 1
2023-05-23 21:47:47 +02:00
2023-11-18 08:18:43 +01:00
sources/go-ggml-transformers/libtransformers.a : sources /go -ggml -transformers
$( MAKE) -C sources/go-ggml-transformers BUILD_TYPE = $( BUILD_TYPE) libtransformers.a
2023-04-20 19:33:36 +02:00
2023-11-18 08:18:43 +01:00
sources/whisper.cpp :
git clone https://github.com/ggerganov/whisper.cpp.git sources/whisper.cpp
cd sources/whisper.cpp && git checkout -b build $( WHISPER_CPP_VERSION) && git submodule update --init --recursive --depth 1
2023-05-09 11:43:50 +02:00
2023-11-18 08:18:43 +01:00
sources/whisper.cpp/libwhisper.a : sources /whisper .cpp
cd sources/whisper.cpp && make libwhisper.a
2023-05-09 11:43:50 +02:00
2023-11-18 08:18:43 +01:00
sources/go-llama :
git clone --recurse-submodules https://github.com/go-skynet/go-llama.cpp sources/go-llama
cd sources/go-llama && git checkout -b build $( GOLLAMA_VERSION) && git submodule update --init --recursive --depth 1
2023-04-19 17:10:29 +02:00
2023-11-18 08:18:43 +01:00
sources/go-llama-ggml :
git clone --recurse-submodules https://github.com/go-skynet/go-llama.cpp sources/go-llama-ggml
cd sources/go-llama-ggml && git checkout -b build $( GOLLAMA_STABLE_VERSION) && git submodule update --init --recursive --depth 1
2023-08-20 16:35:42 +02:00
2023-11-18 08:18:43 +01:00
sources/go-llama/libbinding.a : sources /go -llama
$( MAKE) -C sources/go-llama BUILD_TYPE = $( BUILD_TYPE) libbinding.a
2023-04-19 17:10:29 +02:00
2023-11-18 08:18:43 +01:00
sources/go-llama-ggml/libbinding.a : sources /go -llama -ggml
$( MAKE) -C sources/go-llama-ggml BUILD_TYPE = $( STABLE_BUILD_TYPE) libbinding.a
2023-08-20 16:35:42 +02:00
2023-11-18 08:18:43 +01:00
sources/go-piper/libpiper_binding.a : sources /go -piper
$( MAKE) -C sources/go-piper libpiper_binding.a example/main
2023-06-22 17:53:10 +02:00
2023-11-25 08:48:24 +01:00
backend/cpp/llama/llama.cpp :
$( MAKE) -C backend/cpp/llama llama.cpp
get-sources : backend /cpp /llama /llama .cpp sources /go -llama sources /go -llama -ggml sources /go -ggml -transformers sources /gpt 4all sources /go -piper sources /go -rwkv sources /whisper .cpp sources /go -bert sources /go -stable -diffusion
2023-06-26 16:34:03 -04:00
touch $@
2023-04-20 19:33:36 +02:00
replace :
2023-11-18 08:18:43 +01:00
$( GOCMD) mod edit -replace github.com/nomic-ai/gpt4all/gpt4all-bindings/golang= $( shell pwd ) /sources/gpt4all/gpt4all-bindings/golang
$( GOCMD) mod edit -replace github.com/go-skynet/go-ggml-transformers.cpp= $( shell pwd ) /sources/go-ggml-transformers
$( GOCMD) mod edit -replace github.com/donomii/go-rwkv.cpp= $( shell pwd ) /sources/go-rwkv
$( GOCMD) mod edit -replace github.com/ggerganov/whisper.cpp= $( shell pwd ) /sources/whisper.cpp
2023-12-02 10:10:18 +00:00
$( GOCMD) mod edit -replace github.com/ggerganov/whisper.cpp/bindings/go= $( shell pwd ) /sources/whisper.cpp/bindings/go
2023-11-18 08:18:43 +01:00
$( GOCMD) mod edit -replace github.com/go-skynet/go-bert.cpp= $( shell pwd ) /sources/go-bert
$( GOCMD) mod edit -replace github.com/mudler/go-stable-diffusion= $( shell pwd ) /sources/go-stable-diffusion
$( GOCMD) mod edit -replace github.com/mudler/go-piper= $( shell pwd ) /sources/go-piper
2023-04-20 19:33:36 +02:00
2023-06-26 16:34:03 -04:00
prepare-sources : get -sources replace
2023-04-29 20:38:37 +02:00
$( GOCMD) mod download
2023-11-25 08:48:24 +01:00
touch $@
2023-04-29 20:38:37 +02:00
2023-05-03 11:45:22 +02:00
## GENERIC
rebuild : ## Rebuilds the project
2023-07-05 18:24:55 +02:00
$( GOCMD) clean -cache
2023-11-18 08:18:43 +01:00
$( MAKE) -C sources/go-llama clean
$( MAKE) -C sources/go-llama-ggml clean
$( MAKE) -C sources/gpt4all/gpt4all-bindings/golang/ clean
$( MAKE) -C sources/go-ggml-transformers clean
$( MAKE) -C sources/go-rwkv clean
$( MAKE) -C sources/whisper.cpp clean
$( MAKE) -C sources/go-stable-diffusion clean
$( MAKE) -C sources/go-bert clean
$( MAKE) -C sources/go-piper clean
2023-04-29 20:38:37 +02:00
$( MAKE) build
2023-09-05 01:11:28 +08:00
prepare : prepare -sources $( OPTIONAL_TARGETS )
2023-06-26 16:34:03 -04:00
touch $@
2023-04-19 17:10:29 +02:00
2023-04-15 16:39:07 -07:00
clean : ## Remove build related file
2023-07-05 18:24:55 +02:00
$( GOCMD) clean -cache
2023-07-25 17:02:46 -04:00
rm -f prepare
2023-11-18 08:18:43 +01:00
rm -rf ./sources
2023-04-19 17:10:29 +02:00
rm -rf $( BINARY_NAME)
2023-05-23 17:12:48 +02:00
rm -rf release/
2023-11-06 19:07:46 +01:00
rm -rf ./backend/cpp/grpc/grpc_repo
rm -rf ./backend/cpp/grpc/build
rm -rf ./backend/cpp/grpc/installed_packages
2023-10-16 21:46:29 +02:00
$( MAKE) -C backend/cpp/llama clean
2023-04-15 16:39:07 -07:00
2023-05-03 11:45:22 +02:00
## Build:
2023-07-15 01:19:43 +02:00
build : grpcs prepare ## Build the project
2023-05-03 11:45:22 +02:00
$( info ${ GREEN } I local-ai build info:${ RESET } )
$( info ${ GREEN } I BUILD_TYPE: ${ YELLOW } $( BUILD_TYPE) ${ RESET } )
2023-05-16 19:32:53 +02:00
$( info ${ GREEN } I GO_TAGS: ${ YELLOW } $( GO_TAGS) ${ RESET } )
2023-06-26 15:12:43 +02:00
$( info ${ GREEN } I LD_FLAGS: ${ YELLOW } $( LD_FLAGS) ${ RESET } )
2023-07-15 01:19:43 +02:00
CGO_LDFLAGS = " $( CGO_LDFLAGS) " $( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o $( BINARY_NAME) ./
2023-05-03 11:45:22 +02:00
2023-05-23 17:12:48 +02:00
dist : build
mkdir -p release
cp $( BINARY_NAME) release/$( BINARY_NAME) -$( BUILD_ID) -$( OS) -$( ARCH)
2023-11-23 09:22:54 -05:00
osx-signed : build
codesign --deep --force --sign " $( OSX_SIGNING_IDENTITY) " --entitlements "./Entitlements.plist" " ./ $( BINARY_NAME) "
2023-05-03 11:45:22 +02:00
## Run
run : prepare ## run local-ai
2023-07-15 01:19:43 +02:00
CGO_LDFLAGS = " $( CGO_LDFLAGS) " $( GOCMD) run ./
2023-04-15 16:39:07 -07:00
2023-04-22 00:44:52 +02:00
test-models/testmodel :
mkdir test-models
2023-05-12 10:04:20 +02:00
mkdir test-dir
feat(conda): conda environments (#1144)
* feat(autogptq): add a separate conda environment for autogptq (#1137)
**Description**
This PR related to #1117
**Notes for Reviewers**
Here we lock down the version of the dependencies. Make sure it can be
used all the time without failed if the version of dependencies were
upgraded.
I change the order of importing packages according to the pylint, and no
change the logic of code. It should be ok.
I will do more investigate on writing some test cases for every backend.
I can run the service in my environment, but there is not exist a way to
test it. So, I am not confident on it.
Add a README.md in the `grpc` root. This is the common commands for
creating `conda` environment. And it can be used to the reference file
for creating extral gRPC backend document.
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* [Extra backend] Add seperate environment for ttsbark (#1141)
**Description**
This PR relates to #1117
**Notes for Reviewers**
Same to the latest PR:
* The code is also changed, but only the order of the import package
parts. And some code comments are also added.
* Add a configuration of the `conda` environment
* Add a simple test case for testing if the service can be startup in
current `conda` environment. It is succeed in VSCode, but the it is not
out of box on terminal. So, it is hard to say the test case really
useful.
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): add make target and entrypoints for the dockerfile
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add seperate conda env for diffusers (#1145)
**Description**
This PR relates to #1117
**Notes for Reviewers**
* Add `conda` env `diffusers.yml`
* Add Makefile to create it automatically
* Add `run.sh` to support running as a extra backend
* Also adding it to the main Dockerfile
* Add make command in the root Makefile
* Testing the server, it can start up under the env
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for vllm (#1148)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server can be started as normal
* The test case can be triggered in VSCode
* Same to other this kind of PRs, add `vllm.yml` Makefile and add
`run.sh` to the main Dockerfile, and command to the main Makefile
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for huggingface (#1146)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* Add conda env `huggingface.yml`
* Change the import order, and also remove the no-used packages
* Add `run.sh` and `make command` to the main Dockerfile and Makefile
* Add test cases for it. It can be triggered and succeed under VSCode
Python extension but it is hang by using `python -m unites
test_huggingface.py` in the terminal
```
Running tests (unittest): /workspaces/LocalAI/extra/grpc/huggingface
Running tests: /workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_embedding
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_load_model
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_server_startup
./test_huggingface.py::TestBackendServicer::test_embedding Passed
./test_huggingface.py::TestBackendServicer::test_load_model Passed
./test_huggingface.py::TestBackendServicer::test_server_startup Passed
Total number of tests expected to run: 3
Total number of tests run: 3
Total number of tests passed: 3
Total number of tests failed: 0
Total number of tests failed with errors: 0
Total number of tests skipped: 0
Finished running tests!
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add the seperate conda env for VALL-E X (#1147)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server cannot start up
```
(ttsvalle) @Aisuko ➜ /workspaces/LocalAI (feat/vall-e-x) $ /opt/conda/envs/ttsvalle/bin/python /workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py
Traceback (most recent call last):
File "/workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py", line 14, in <module>
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
ModuleNotFoundError: No module named 'utils'
```
The installation steps follow
https://github.com/Plachtaa/VALL-E-X#-installation below:
* Under the `ttsvalle` conda env
```
git clone https://github.com/Plachtaa/VALL-E-X.git
cd VALL-E-X
pip install -r requirements.txt
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fix: set image type
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate conda env for exllama (#1149)
Add seperate env for exllama
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Setup conda
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Set image_type arg
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* ci: prepare only conda env in tests
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Dockerfile: comment manual pip calls
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* conda: add conda to PATH
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fixes
* add shebang
* Fixups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* file perms
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* debug
* Install new conda in the worker
* Disable GPU tests for now until the worker is back
* Rename workflows
* debug
* Fixup conda install
* fixup(wrapper): pass args
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
---------
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
Co-authored-by: Aisuko <urakiny@gmail.com>
2023-11-04 15:30:32 +01:00
wget -q https://huggingface.co/nnakasato/ggml-model-test/resolve/main/ggml-model-q4.bin -O test-models/testmodel
wget -q https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin -O test-models/whisper-en
wget -q https://huggingface.co/mudler/all-MiniLM-L6-v2/resolve/main/ggml-model-q4_0.bin -O test-models/bert
wget -q https://cdn.openai.com/whisper/draft-20220913a/micro-machines.wav -O test-dir/audio.wav
wget -q https://huggingface.co/mudler/rwkv-4-raven-1.5B-ggml/resolve/main/RWKV-4-Raven-1B5-v11-Eng99%2525-Other1%2525-20230425-ctx4096_Q4_0.bin -O test-models/rwkv
wget -q https://raw.githubusercontent.com/saharNooby/rwkv.cpp/5eb8f09c146ea8124633ab041d9ea0b1f1db4459/rwkv/20B_tokenizer.json -O test-models/rwkv.tokenizer.json
2023-05-18 15:59:03 +02:00
cp tests/models_fixtures/* test-models
2023-04-22 00:44:52 +02:00
2023-07-15 01:19:43 +02:00
prepare-test : grpcs
2023-07-15 01:19:43 +02:00
cp -rf backend-assets api
2023-05-18 15:59:03 +02:00
cp tests/models_fixtures/* test-models
2023-07-15 01:19:43 +02:00
test : prepare test -models /testmodel grpcs
@echo 'Running tests'
export GO_TAGS = "tts stablediffusion"
$( MAKE) prepare-test
2023-11-20 21:21:17 +01:00
HUGGINGFACE_GRPC = $( abspath ./) /backend/python/sentencetransformers/run.sh TEST_DIR = $( abspath ./) /test-dir/ FIXTURES = $( abspath ./) /tests/fixtures CONFIG_FILE = $( abspath ./) /test-models/config.yaml MODELS_PATH = $( abspath ./) /test-models \
2023-11-05 09:01:03 +01:00
$( GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter= "!gpt4all && !llama && !llama-gguf" --flake-attempts 5 --fail-fast -v -r ./api ./pkg
2023-07-15 01:19:43 +02:00
$( MAKE) test-gpt4all
$( MAKE) test-llama
2023-08-24 01:18:58 +02:00
$( MAKE) test-llama-gguf
2023-07-15 01:19:43 +02:00
$( MAKE) test-tts
$( MAKE) test-stablediffusion
2023-10-19 13:50:40 +02:00
prepare-e2e :
mkdir -p $( TEST_DIR)
cp -rfv $( abspath ./tests/e2e-fixtures) /gpu.yaml $( TEST_DIR) /gpu.yaml
test -e $( TEST_DIR) /ggllm-test-model.bin || wget -q https://huggingface.co/TheBloke/CodeLlama-7B-Instruct-GGUF/resolve/main/codellama-7b-instruct.Q2_K.gguf -O $( TEST_DIR) /ggllm-test-model.bin
docker build --build-arg BUILD_GRPC = true --build-arg GRPC_BACKENDS = " $( GRPC_BACKENDS) " --build-arg IMAGE_TYPE = core --build-arg BUILD_TYPE = $( BUILD_TYPE) --build-arg CUDA_MAJOR_VERSION = 11 --build-arg CUDA_MINOR_VERSION = 7 --build-arg FFMPEG = true -t localai-tests .
run-e2e-image :
ls -liah $( abspath ./tests/e2e-fixtures)
docker run -p 5390:8080 -e MODELS_PATH = /models -e THREADS = 1 -e DEBUG = true -d --rm -v $( TEST_DIR) :/models --gpus all --name e2e-tests-$( RANDOM) localai-tests
test-e2e :
@echo 'Running e2e tests'
BUILD_TYPE = $( BUILD_TYPE) \
LOCALAI_API = http://$( E2E_BRIDGE_IP) :5390/v1 \
$( GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --flake-attempts 5 -v -r ./tests/e2e
teardown-e2e :
rm -rf $( TEST_DIR) || true
docker stop $$ ( docker ps -q --filter ancestor = localai-tests)
2023-07-15 01:19:43 +02:00
test-gpt4all : prepare -test
TEST_DIR = $( abspath ./) /test-dir/ FIXTURES = $( abspath ./) /tests/fixtures CONFIG_FILE = $( abspath ./) /test-models/config.yaml MODELS_PATH = $( abspath ./) /test-models \
$( GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter= "gpt4all" --flake-attempts 5 -v -r ./api ./pkg
test-llama : prepare -test
TEST_DIR = $( abspath ./) /test-dir/ FIXTURES = $( abspath ./) /tests/fixtures CONFIG_FILE = $( abspath ./) /test-models/config.yaml MODELS_PATH = $( abspath ./) /test-models \
$( GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter= "llama" --flake-attempts 5 -v -r ./api ./pkg
2023-08-24 01:18:58 +02:00
test-llama-gguf : prepare -test
TEST_DIR = $( abspath ./) /test-dir/ FIXTURES = $( abspath ./) /tests/fixtures CONFIG_FILE = $( abspath ./) /test-models/config.yaml MODELS_PATH = $( abspath ./) /test-models \
$( GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter= "llama-gguf" --flake-attempts 5 -v -r ./api ./pkg
2023-07-15 01:19:43 +02:00
test-tts : prepare -test
TEST_DIR = $( abspath ./) /test-dir/ FIXTURES = $( abspath ./) /tests/fixtures CONFIG_FILE = $( abspath ./) /test-models/config.yaml MODELS_PATH = $( abspath ./) /test-models \
$( GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter= "tts" --flake-attempts 1 -v -r ./api ./pkg
test-stablediffusion : prepare -test
TEST_DIR = $( abspath ./) /test-dir/ FIXTURES = $( abspath ./) /tests/fixtures CONFIG_FILE = $( abspath ./) /test-models/config.yaml MODELS_PATH = $( abspath ./) /test-models \
$( GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter= "stablediffusion" --flake-attempts 1 -v -r ./api ./pkg
test-container :
docker build --target requirements -t local-ai-test-container .
2023-07-20 22:10:42 +02:00
docker run -ti --rm --entrypoint /bin/bash -ti -v $( abspath ./) :/build local-ai-test-container
2023-04-15 16:39:07 -07:00
## 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)} \
2023-04-17 21:34:02 +02:00
}' $( MAKEFILE_LIST)
2023-07-15 01:19:43 +02:00
2023-07-20 22:10:42 +02:00
protogen : protogen -go protogen -python
protogen-go :
2023-07-15 01:19:43 +02:00
protoc --go_out= . --go_opt= paths = source_relative --go-grpc_out= . --go-grpc_opt= paths = source_relative \
2023-11-13 22:40:16 +01:00
backend/backend.proto
2023-07-15 01:19:43 +02:00
2023-07-20 22:10:42 +02:00
protogen-python :
2023-11-20 21:21:17 +01:00
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/sentencetransformers/ --grpc_python_out= backend/python/sentencetransformers/ backend/backend.proto
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/transformers/ --grpc_python_out= backend/python/transformers/ backend/backend.proto
2023-12-08 04:01:02 -05:00
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/transformers-musicgen/ --grpc_python_out= backend/python/transformers-musicgen/ backend/backend.proto
2023-11-20 21:21:17 +01:00
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/autogptq/ --grpc_python_out= backend/python/autogptq/ backend/backend.proto
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/exllama/ --grpc_python_out= backend/python/exllama/ backend/backend.proto
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/bark/ --grpc_python_out= backend/python/bark/ backend/backend.proto
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/diffusers/ --grpc_python_out= backend/python/diffusers/ backend/backend.proto
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/vall-e-x/ --grpc_python_out= backend/python/vall-e-x/ backend/backend.proto
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/vllm/ --grpc_python_out= backend/python/vllm/ backend/backend.proto
2023-11-28 09:01:46 +01:00
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/petals/ --grpc_python_out= backend/python/petals/ backend/backend.proto
2023-12-05 08:15:37 +01:00
python3 -m grpc_tools.protoc -Ibackend/ --python_out= backend/python/exllama2/ --grpc_python_out= backend/python/exllama2/ backend/backend.proto
2023-07-20 22:10:42 +02:00
2023-07-15 01:19:43 +02:00
## GRPC
2023-11-05 10:31:33 +01:00
# Note: it is duplicated in the Dockerfile
feat(conda): conda environments (#1144)
* feat(autogptq): add a separate conda environment for autogptq (#1137)
**Description**
This PR related to #1117
**Notes for Reviewers**
Here we lock down the version of the dependencies. Make sure it can be
used all the time without failed if the version of dependencies were
upgraded.
I change the order of importing packages according to the pylint, and no
change the logic of code. It should be ok.
I will do more investigate on writing some test cases for every backend.
I can run the service in my environment, but there is not exist a way to
test it. So, I am not confident on it.
Add a README.md in the `grpc` root. This is the common commands for
creating `conda` environment. And it can be used to the reference file
for creating extral gRPC backend document.
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* [Extra backend] Add seperate environment for ttsbark (#1141)
**Description**
This PR relates to #1117
**Notes for Reviewers**
Same to the latest PR:
* The code is also changed, but only the order of the import package
parts. And some code comments are also added.
* Add a configuration of the `conda` environment
* Add a simple test case for testing if the service can be startup in
current `conda` environment. It is succeed in VSCode, but the it is not
out of box on terminal. So, it is hard to say the test case really
useful.
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): add make target and entrypoints for the dockerfile
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add seperate conda env for diffusers (#1145)
**Description**
This PR relates to #1117
**Notes for Reviewers**
* Add `conda` env `diffusers.yml`
* Add Makefile to create it automatically
* Add `run.sh` to support running as a extra backend
* Also adding it to the main Dockerfile
* Add make command in the root Makefile
* Testing the server, it can start up under the env
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for vllm (#1148)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server can be started as normal
* The test case can be triggered in VSCode
* Same to other this kind of PRs, add `vllm.yml` Makefile and add
`run.sh` to the main Dockerfile, and command to the main Makefile
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for huggingface (#1146)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* Add conda env `huggingface.yml`
* Change the import order, and also remove the no-used packages
* Add `run.sh` and `make command` to the main Dockerfile and Makefile
* Add test cases for it. It can be triggered and succeed under VSCode
Python extension but it is hang by using `python -m unites
test_huggingface.py` in the terminal
```
Running tests (unittest): /workspaces/LocalAI/extra/grpc/huggingface
Running tests: /workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_embedding
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_load_model
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_server_startup
./test_huggingface.py::TestBackendServicer::test_embedding Passed
./test_huggingface.py::TestBackendServicer::test_load_model Passed
./test_huggingface.py::TestBackendServicer::test_server_startup Passed
Total number of tests expected to run: 3
Total number of tests run: 3
Total number of tests passed: 3
Total number of tests failed: 0
Total number of tests failed with errors: 0
Total number of tests skipped: 0
Finished running tests!
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add the seperate conda env for VALL-E X (#1147)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server cannot start up
```
(ttsvalle) @Aisuko ➜ /workspaces/LocalAI (feat/vall-e-x) $ /opt/conda/envs/ttsvalle/bin/python /workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py
Traceback (most recent call last):
File "/workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py", line 14, in <module>
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
ModuleNotFoundError: No module named 'utils'
```
The installation steps follow
https://github.com/Plachtaa/VALL-E-X#-installation below:
* Under the `ttsvalle` conda env
```
git clone https://github.com/Plachtaa/VALL-E-X.git
cd VALL-E-X
pip install -r requirements.txt
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fix: set image type
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate conda env for exllama (#1149)
Add seperate env for exllama
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Setup conda
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Set image_type arg
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* ci: prepare only conda env in tests
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Dockerfile: comment manual pip calls
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* conda: add conda to PATH
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fixes
* add shebang
* Fixups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* file perms
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* debug
* Install new conda in the worker
* Disable GPU tests for now until the worker is back
* Rename workflows
* debug
* Fixup conda install
* fixup(wrapper): pass args
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
---------
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
Co-authored-by: Aisuko <urakiny@gmail.com>
2023-11-04 15:30:32 +01:00
prepare-extra-conda-environments :
2023-11-13 22:40:16 +01:00
$( MAKE) -C backend/python/autogptq
$( MAKE) -C backend/python/bark
$( MAKE) -C backend/python/diffusers
$( MAKE) -C backend/python/vllm
2023-11-20 21:21:17 +01:00
$( MAKE) -C backend/python/sentencetransformers
$( MAKE) -C backend/python/transformers
2023-12-08 04:01:02 -05:00
$( MAKE) -C backend/python/transformers-musicgen
2023-11-13 22:40:16 +01:00
$( MAKE) -C backend/python/vall-e-x
$( MAKE) -C backend/python/exllama
2023-11-28 09:01:46 +01:00
$( MAKE) -C backend/python/petals
2023-12-05 08:15:37 +01:00
$( MAKE) -C backend/python/exllama2
feat(conda): conda environments (#1144)
* feat(autogptq): add a separate conda environment for autogptq (#1137)
**Description**
This PR related to #1117
**Notes for Reviewers**
Here we lock down the version of the dependencies. Make sure it can be
used all the time without failed if the version of dependencies were
upgraded.
I change the order of importing packages according to the pylint, and no
change the logic of code. It should be ok.
I will do more investigate on writing some test cases for every backend.
I can run the service in my environment, but there is not exist a way to
test it. So, I am not confident on it.
Add a README.md in the `grpc` root. This is the common commands for
creating `conda` environment. And it can be used to the reference file
for creating extral gRPC backend document.
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* [Extra backend] Add seperate environment for ttsbark (#1141)
**Description**
This PR relates to #1117
**Notes for Reviewers**
Same to the latest PR:
* The code is also changed, but only the order of the import package
parts. And some code comments are also added.
* Add a configuration of the `conda` environment
* Add a simple test case for testing if the service can be startup in
current `conda` environment. It is succeed in VSCode, but the it is not
out of box on terminal. So, it is hard to say the test case really
useful.
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): add make target and entrypoints for the dockerfile
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add seperate conda env for diffusers (#1145)
**Description**
This PR relates to #1117
**Notes for Reviewers**
* Add `conda` env `diffusers.yml`
* Add Makefile to create it automatically
* Add `run.sh` to support running as a extra backend
* Also adding it to the main Dockerfile
* Add make command in the root Makefile
* Testing the server, it can start up under the env
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for vllm (#1148)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server can be started as normal
* The test case can be triggered in VSCode
* Same to other this kind of PRs, add `vllm.yml` Makefile and add
`run.sh` to the main Dockerfile, and command to the main Makefile
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for huggingface (#1146)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* Add conda env `huggingface.yml`
* Change the import order, and also remove the no-used packages
* Add `run.sh` and `make command` to the main Dockerfile and Makefile
* Add test cases for it. It can be triggered and succeed under VSCode
Python extension but it is hang by using `python -m unites
test_huggingface.py` in the terminal
```
Running tests (unittest): /workspaces/LocalAI/extra/grpc/huggingface
Running tests: /workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_embedding
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_load_model
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_server_startup
./test_huggingface.py::TestBackendServicer::test_embedding Passed
./test_huggingface.py::TestBackendServicer::test_load_model Passed
./test_huggingface.py::TestBackendServicer::test_server_startup Passed
Total number of tests expected to run: 3
Total number of tests run: 3
Total number of tests passed: 3
Total number of tests failed: 0
Total number of tests failed with errors: 0
Total number of tests skipped: 0
Finished running tests!
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add the seperate conda env for VALL-E X (#1147)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server cannot start up
```
(ttsvalle) @Aisuko ➜ /workspaces/LocalAI (feat/vall-e-x) $ /opt/conda/envs/ttsvalle/bin/python /workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py
Traceback (most recent call last):
File "/workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py", line 14, in <module>
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
ModuleNotFoundError: No module named 'utils'
```
The installation steps follow
https://github.com/Plachtaa/VALL-E-X#-installation below:
* Under the `ttsvalle` conda env
```
git clone https://github.com/Plachtaa/VALL-E-X.git
cd VALL-E-X
pip install -r requirements.txt
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fix: set image type
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate conda env for exllama (#1149)
Add seperate env for exllama
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Setup conda
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Set image_type arg
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* ci: prepare only conda env in tests
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Dockerfile: comment manual pip calls
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* conda: add conda to PATH
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fixes
* add shebang
* Fixups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* file perms
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* debug
* Install new conda in the worker
* Disable GPU tests for now until the worker is back
* Rename workflows
* debug
* Fixup conda install
* fixup(wrapper): pass args
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
---------
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
Co-authored-by: Aisuko <urakiny@gmail.com>
2023-11-04 15:30:32 +01:00
2023-12-08 15:45:04 +01:00
prepare-test-extra :
$( MAKE) -C backend/python/transformers
test-extra : prepare -test -extra
$( MAKE) -C backend/python/transformers test
feat(conda): conda environments (#1144)
* feat(autogptq): add a separate conda environment for autogptq (#1137)
**Description**
This PR related to #1117
**Notes for Reviewers**
Here we lock down the version of the dependencies. Make sure it can be
used all the time without failed if the version of dependencies were
upgraded.
I change the order of importing packages according to the pylint, and no
change the logic of code. It should be ok.
I will do more investigate on writing some test cases for every backend.
I can run the service in my environment, but there is not exist a way to
test it. So, I am not confident on it.
Add a README.md in the `grpc` root. This is the common commands for
creating `conda` environment. And it can be used to the reference file
for creating extral gRPC backend document.
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* [Extra backend] Add seperate environment for ttsbark (#1141)
**Description**
This PR relates to #1117
**Notes for Reviewers**
Same to the latest PR:
* The code is also changed, but only the order of the import package
parts. And some code comments are also added.
* Add a configuration of the `conda` environment
* Add a simple test case for testing if the service can be startup in
current `conda` environment. It is succeed in VSCode, but the it is not
out of box on terminal. So, it is hard to say the test case really
useful.
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): add make target and entrypoints for the dockerfile
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add seperate conda env for diffusers (#1145)
**Description**
This PR relates to #1117
**Notes for Reviewers**
* Add `conda` env `diffusers.yml`
* Add Makefile to create it automatically
* Add `run.sh` to support running as a extra backend
* Also adding it to the main Dockerfile
* Add make command in the root Makefile
* Testing the server, it can start up under the env
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for vllm (#1148)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server can be started as normal
* The test case can be triggered in VSCode
* Same to other this kind of PRs, add `vllm.yml` Makefile and add
`run.sh` to the main Dockerfile, and command to the main Makefile
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate env for huggingface (#1146)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* Add conda env `huggingface.yml`
* Change the import order, and also remove the no-used packages
* Add `run.sh` and `make command` to the main Dockerfile and Makefile
* Add test cases for it. It can be triggered and succeed under VSCode
Python extension but it is hang by using `python -m unites
test_huggingface.py` in the terminal
```
Running tests (unittest): /workspaces/LocalAI/extra/grpc/huggingface
Running tests: /workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_embedding
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_load_model
/workspaces/LocalAI/extra/grpc/huggingface/test_huggingface.py::TestBackendServicer::test_server_startup
./test_huggingface.py::TestBackendServicer::test_embedding Passed
./test_huggingface.py::TestBackendServicer::test_load_model Passed
./test_huggingface.py::TestBackendServicer::test_server_startup Passed
Total number of tests expected to run: 3
Total number of tests run: 3
Total number of tests passed: 3
Total number of tests failed: 0
Total number of tests failed with errors: 0
Total number of tests skipped: 0
Finished running tests!
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda): Add the seperate conda env for VALL-E X (#1147)
**Description**
This PR is related to #1117
**Notes for Reviewers**
* The gRPC server cannot start up
```
(ttsvalle) @Aisuko ➜ /workspaces/LocalAI (feat/vall-e-x) $ /opt/conda/envs/ttsvalle/bin/python /workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py
Traceback (most recent call last):
File "/workspaces/LocalAI/extra/grpc/vall-e-x/ttsvalle.py", line 14, in <module>
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
ModuleNotFoundError: No module named 'utils'
```
The installation steps follow
https://github.com/Plachtaa/VALL-E-X#-installation below:
* Under the `ttsvalle` conda env
```
git clone https://github.com/Plachtaa/VALL-E-X.git
cd VALL-E-X
pip install -r requirements.txt
```
**[Signed
commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)**
- [x] Yes, I signed my commits.
<!--
Thank you for contributing to LocalAI!
Contributing Conventions
-------------------------
The draft above helps to give a quick overview of your PR.
Remember to remove this comment and to at least:
1. Include descriptive PR titles with [<component-name>] prepended. We
use [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
2. Build and test your changes before submitting a PR (`make build`).
3. Sign your commits
4. **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below).
5. **X/Twitter handle:** we announce bigger features on X/Twitter. If
your PR gets announced, and you'd like a mention, we'll gladly shout you
out!
By following the community's contribution conventions upfront, the
review process will
be accelerated and your PR merged more quickly.
If no one reviews your PR within a few days, please @-mention @mudler.
-->
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fix: set image type
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* feat(conda):Add seperate conda env for exllama (#1149)
Add seperate env for exllama
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Setup conda
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Set image_type arg
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* ci: prepare only conda env in tests
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* Dockerfile: comment manual pip calls
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* conda: add conda to PATH
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* fixes
* add shebang
* Fixups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* file perms
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* debug
* Install new conda in the worker
* Disable GPU tests for now until the worker is back
* Rename workflows
* debug
* Fixup conda install
* fixup(wrapper): pass args
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
---------
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Aisuko <urakiny@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
Co-authored-by: Aisuko <urakiny@gmail.com>
2023-11-04 15:30:32 +01:00
2023-07-15 01:19:43 +02:00
backend-assets/grpc :
mkdir -p backend-assets/grpc
2023-11-18 08:18:43 +01:00
backend-assets/grpc/llama : backend -assets /grpc sources /go -llama /libbinding .a
$( GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp= $( shell pwd ) /sources/go-llama
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-llama LIBRARY_PATH = $( shell pwd ) /sources/go-llama \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/llama ./backend/go/llm/llama/
2023-11-30 13:50:50 -05:00
# TODO: every binary should have its own folder instead, so can have different implementations
2023-07-20 22:00:07 +02:00
i f e q ( $( BUILD_TYPE ) , m e t a l )
2023-11-30 13:50:50 -05:00
c p b a c k e n d / c p p / l l a m a / l l a m a . c p p / g g m l - m e t a l . m e t a l b a c k e n d - a s s e t s / g r p c /
2023-07-20 22:00:07 +02:00
e n d i f
2023-07-15 01:19:43 +02:00
2023-11-06 19:07:46 +01:00
## BACKEND CPP LLAMA START
# Sets the variables in case it has to build the gRPC locally.
INSTALLED_PACKAGES = $( CURDIR) /backend/cpp/grpc/installed_packages
INSTALLED_LIB_CMAKE = $( INSTALLED_PACKAGES) /lib/cmake
ADDED_CMAKE_ARGS = -Dabsl_DIR= ${ INSTALLED_LIB_CMAKE } /absl \
-DProtobuf_DIR= ${ INSTALLED_LIB_CMAKE } /protobuf \
-Dutf8_range_DIR= ${ INSTALLED_LIB_CMAKE } /utf8_range \
-DgRPC_DIR= ${ INSTALLED_LIB_CMAKE } /grpc \
-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES= ${ INSTALLED_PACKAGES } /include
2023-10-16 21:46:29 +02:00
2023-11-06 19:07:46 +01:00
backend/cpp/llama/grpc-server :
i f d e f B U I L D _ G R P C _ F O R _ B A C K E N D _ L L A M A
b a c k e n d / c p p / g r p c / s c r i p t / b u i l d _ g r p c . s h $ { I N S T A L L E D _ P A C K A G E S }
export _PROTOBUF_PROTOC = ${ INSTALLED_PACKAGES } /bin/proto && \
export _GRPC_CPP_PLUGIN_EXECUTABLE = ${ INSTALLED_PACKAGES } /bin/grpc_cpp_plugin && \
export PATH = ${ PATH } :${ INSTALLED_PACKAGES } /bin && \
2023-11-25 13:53:51 +01:00
CMAKE_ARGS = " ${ CMAKE_ARGS } ${ ADDED_CMAKE_ARGS } " LLAMA_VERSION = $( CPPLLAMA_VERSION) $( MAKE) -C backend/cpp/llama grpc-server
2023-11-06 19:07:46 +01:00
e l s e
e c h o "BUILD_GRPC_FOR_BACKEND_LLAMA is not defined."
LLAMA_VERSION = $( CPPLLAMA_VERSION) $( MAKE) -C backend/cpp/llama grpc-server
e n d i f
## BACKEND CPP LLAMA END
##
2023-10-16 21:46:29 +02:00
backend-assets/grpc/llama-cpp : backend -assets /grpc backend /cpp /llama /grpc -server
cp -rfv backend/cpp/llama/grpc-server backend-assets/grpc/llama-cpp
# TODO: every binary should have its own folder instead, so can have different metal implementations
i f e q ( $( BUILD_TYPE ) , m e t a l )
c p b a c k e n d / c p p / l l a m a / l l a m a . c p p / b u i l d / b i n / g g m l - m e t a l . m e t a l b a c k e n d - a s s e t s / g r p c /
e n d i f
2023-11-18 08:18:43 +01:00
backend-assets/grpc/llama-ggml : backend -assets /grpc sources /go -llama -ggml /libbinding .a
$( GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp= $( shell pwd ) /sources/go-llama-ggml
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-llama-ggml LIBRARY_PATH = $( shell pwd ) /sources/go-llama-ggml \
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/llama-ggml ./backend/go/llm/llama-ggml/
2023-08-20 16:35:42 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/gpt4all : backend -assets /grpc backend -assets /gpt 4all sources /gpt 4all /gpt 4all -bindings /golang /libgpt 4all .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/gpt4all/gpt4all-bindings/golang/ LIBRARY_PATH = $( shell pwd ) /sources/gpt4all/gpt4all-bindings/golang/ \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/gpt4all ./backend/go/llm/gpt4all/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/dolly : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/dolly ./backend/go/llm/dolly/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/gpt2 : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/gpt2 ./backend/go/llm/gpt2/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/gptj : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/gptj ./backend/go/llm/gptj/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/gptneox : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/gptneox ./backend/go/llm/gptneox/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/mpt : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/mpt ./backend/go/llm/mpt/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/replit : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/replit ./backend/go/llm/replit/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/falcon-ggml : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/falcon-ggml ./backend/go/llm/falcon-ggml/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/starcoder : backend -assets /grpc sources /go -ggml -transformers /libtransformers .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-ggml-transformers LIBRARY_PATH = $( shell pwd ) /sources/go-ggml-transformers \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/starcoder ./backend/go/llm/starcoder/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/rwkv : backend -assets /grpc sources /go -rwkv /librwkv .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-rwkv LIBRARY_PATH = $( shell pwd ) /sources/go-rwkv \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/rwkv ./backend/go/llm/rwkv
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/bert-embeddings : backend -assets /grpc sources /go -bert /libgobert .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-bert LIBRARY_PATH = $( shell pwd ) /sources/go-bert \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/bert-embeddings ./backend/go/llm/bert/
2023-07-15 01:19:43 +02:00
backend-assets/grpc/langchain-huggingface : backend -assets /grpc
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/langchain-huggingface ./backend/go/llm/langchain/
2023-07-15 01:19:43 +02:00
2023-10-16 21:46:29 +02:00
backend-assets/grpc/stablediffusion : backend -assets /grpc
if [ ! -f backend-assets/grpc/stablediffusion ] ; then \
2023-11-18 08:18:43 +01:00
$( MAKE) sources/go-stable-diffusion/libstablediffusion.a; \
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/go-stable-diffusion/ LIBRARY_PATH = $( shell pwd ) /sources/go-stable-diffusion/ \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/stablediffusion ./backend/go/image/; \
2023-10-16 21:46:29 +02:00
fi
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/piper : backend -assets /grpc backend -assets /espeak -ng -data sources /go -piper /libpiper_binding .a
CGO_CXXFLAGS = " $( PIPER_CGO_CXXFLAGS) " CGO_LDFLAGS = " $( PIPER_CGO_LDFLAGS) " LIBRARY_PATH = $( shell pwd ) /sources/go-piper \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/piper ./backend/go/tts/
2023-07-15 01:19:43 +02:00
2023-11-18 08:18:43 +01:00
backend-assets/grpc/whisper : backend -assets /grpc sources /whisper .cpp /libwhisper .a
CGO_LDFLAGS = " $( CGO_LDFLAGS) " C_INCLUDE_PATH = $( shell pwd ) /sources/whisper.cpp LIBRARY_PATH = $( shell pwd ) /sources/whisper.cpp \
2023-11-13 22:40:16 +01:00
$( GOCMD) build -ldflags " $( LD_FLAGS) " -tags " $( GO_TAGS) " -o backend-assets/grpc/whisper ./backend/go/transcribe/
2023-07-15 01:19:43 +02:00
2023-08-13 20:04:08 +02:00
grpcs : prepare $( GRPC_BACKENDS )