diff options
author | Felix Erkinger | 2023-11-28 14:26:56 +0100 |
---|---|---|
committer | Felix Erkinger | 2023-11-28 14:26:56 +0100 |
commit | 3fbc13779a9fdbc705777c41f53727b26c390770 (patch) | |
tree | 290955e1342a14d644d8b440e91843a0815eb714 | |
download | aur-3fbc13779a9fdbc705777c41f53727b26c390770.tar.gz |
addpkg: localai-git 944.20d637e-1
add localai-git
-rw-r--r-- | .SRCINFO | 33 | ||||
-rw-r--r-- | PKGBUILD | 62 | ||||
-rw-r--r-- | whisper-gpu.patch | 56 |
3 files changed, 151 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..db5f7b5d7030 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,33 @@ +pkgbase = localai-git + pkgdesc = The free, Open Source OpenAI alternative. Self-hosted, community-driven and local-first. + pkgver = 944.20d637e + pkgrel = 1 + url = https://github.com/mudler/LocalAI + arch = x86_64 + license = MIT + makedepends = go + makedepends = git + makedepends = cmake + makedepends = ffmpeg + makedepends = opencv + makedepends = blas-openblas + makedepends = rocm-hip-sdk + depends = ffmpeg + depends = opencv + depends = blas-openblas + provides = localai=944.20d637e + provides = localai + conflicts = localai + source = localai::git+https://github.com/mudler/LocalAI + source = whisper-gpu.patch + sha256sums = SKIP + sha256sums = SKIP + +pkgname = localai-git + +pkgname = localai-git-rocm + pkgdesc = The free, Open Source OpenAI alternative. Self-hosted, community-driven and local-first. (with ROCM support) + depends = ffmpeg + depends = opencv + depends = blas-openblas + depends = rocm-hip-runtime diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..b07e0b71e1a7 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,62 @@ +# Maintainer: wuxxin <wuxxin@gmail.com> + +_pkgname="localai" +pkgbase="${_pkgname}-git" +pkgname=("${pkgbase}" "${pkgbase}-rocm") +pkgver="944.20d637e" +pkgrel=1 +pkgdesc="The free, Open Source OpenAI alternative. Self-hosted, community-driven and local-first." +url="https://github.com/mudler/LocalAI" +license=('MIT') +arch=('x86_64') + +depends=('ffmpeg' 'opencv' 'blas-openblas') +makedepends=('go' 'git' 'cmake' 'ffmpeg' 'opencv' 'blas-openblas' 'rocm-hip-sdk') +provides=("localai=${pkgver}" 'localai') +conflicts=('localai') +source=("${_pkgname}"::"git+https://github.com/mudler/LocalAI" + "whisper-gpu.patch") +sha256sums=('SKIP' + 'SKIP') + +pkgver() { + cd "${srcdir}/${_pkgname}" + echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD) +} + +prepare() { + cd "${srcdir}/${_pkgname}" + make prepare + + cd "${srcdir}" + cp -r "${_pkgname}" "${_pkgname}-rocm" + + cd "${srcdir}/${_pkgname}-rocm" + patch -Np1 -i "${srcdir}/whisper-gpu.patch" +} + +build() { + cd "${srcdir}/${_pkgname}" + make BUILD_TYPE="openblas" GOTAGS="tts" build + + cd "${srcdir}/${_pkgname}-rocm" + GPU_TARGETS='gfx900;gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx1102' \ + make BUILD_TYPE="hipblas" GOTAGS="tts" build +} + +package_localai-git() { + cd "${_pkgname}-${pkgver}" + + install -Dm755 "${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}" + install -Dm644 README.md -t "${pkgdir}/usr/share/doc/${_pkgname}" +} + +package_localai-git-rocm() { + cd "${_pkgname}-${pkgver}-rocm" + + pkgdesc+=' (with ROCM support)' + depends+=('rocm-hip-runtime') + + install -Dm755 "${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}" + install -Dm644 README.md -t "${pkgdir}/usr/share/doc/${_pkgname}" +} diff --git a/whisper-gpu.patch b/whisper-gpu.patch new file mode 100644 index 000000000000..2e018edb2734 --- /dev/null +++ b/whisper-gpu.patch @@ -0,0 +1,56 @@ +diff --git a/Makefile b/Makefile +index 666bc8d..d487165 100644 +--- a/Makefile ++++ b/Makefile +@@ -22,7 +22,7 @@ RWKV_REPO?=https://github.com/donomii/go-rwkv.cpp + RWKV_VERSION?=c898cd0f62df8f2a7830e53d1d513bef4f6f792b + + # whisper.cpp version +-WHISPER_CPP_VERSION?=85ed71aaec8e0612a84c0b67804bde75aa75a273 ++WHISPER_CPP_VERSION?=d38af151a1ed5378c5a9ae368e767ed22c8ab141 + + # bert.cpp version + BERT_VERSION?=6abe312cded14042f6b7c3cd8edf082713334a4d +@@ -78,11 +78,13 @@ endif + + ifeq ($(BUILD_TYPE),openblas) + CGO_LDFLAGS+=-lopenblas ++ export WHISPER_OPENBLAS=1 + endif + + ifeq ($(BUILD_TYPE),cublas) + CGO_LDFLAGS+=-lcublas -lcudart -L$(CUDA_LIBPATH) + export LLAMA_CUBLAS=1 ++ export WHISPER_CUBLAS=1 + endif + + ifeq ($(BUILD_TYPE),hipblas) +@@ -91,6 +93,7 @@ ifeq ($(BUILD_TYPE),hipblas) + export CC=$(ROCM_HOME)/llvm/bin/clang + # llama-ggml has no hipblas support, so override it here. + export STABLE_BUILD_TYPE= ++ export WHISPER_HIPBLAS=1 + GPU_TARGETS ?= gfx900,gfx90a,gfx1030,gfx1031,gfx1100 + AMDGPU_TARGETS ?= "$(GPU_TARGETS)" + CMAKE_ARGS+=-DLLAMA_HIPBLAS=ON -DAMDGPU_TARGETS="$(AMDGPU_TARGETS)" -DGPU_TARGETS="$(GPU_TARGETS)" +@@ -100,10 +103,12 @@ endif + ifeq ($(BUILD_TYPE),metal) + CGO_LDFLAGS+=-framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders + export LLAMA_METAL=1 ++ # export WHISPER_METAL=1 + endif + + ifeq ($(BUILD_TYPE),clblas) + CGO_LDFLAGS+=-lOpenCL -lclblast ++ export WHISPER_CLBLAST=1 + endif + + # glibc-static or glibc-devel-static required +@@ -224,6 +229,7 @@ replace: + $(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 ++ $(GOCMD) mod edit -replace github.com/ggerganov/whisper.cpp/bindings/go=$(shell pwd)/sources/whisper.cpp/bindings/go + $(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 |