Skip to content

Commit 3a1727a

Browse files
authored
Merge branch 'master' into default_miro
2 parents 3eb1c1c + eee1fb2 commit 3a1727a

File tree

141 files changed

+2960
-1502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+2960
-1502
lines changed

.devcontainer-scripts/utils.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,22 @@ config_remote() {
3232
}
3333

3434
# Setup special .ssh files
35-
#
35+
# Prints out lines of text to make things pretty
3636
# Param 1: bash array, filenames relative to the customization directory that should be copied to ~/.ssh
3737
setup_ssh() {
38+
echo "starting ~/.ssh directory setup..."
39+
mkdir -p "${HOME}.ssh"
40+
chmod 0700 "${HOME}/.ssh"
41+
echo "-----"
3842
local files=("$@")
39-
for file in "${files[@]}"; then
43+
for file in "${files[@]}" ; do
4044
local cfile="/devcontainer-customization/${file}"
41-
local hfile="~/.ssh/${file}"
45+
local hfile="${HOME}/.ssh/${file}"
4246
if [ ! -f "${hfile}" ]; then
43-
echo "copying ${file}"
47+
echo "copying \"${file}\""
4448
cp "${cfile}" "${hfile}"
4549
chmod 600 "${hfile}"
4650
fi
4751
done
48-
ls ~/.ssh
52+
echo "~/.ssh directory setup complete!"
4953
}

.github/workflows/bump_deps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
rm -rfv ${{ matrix.variable }}_message.txt
5757
rm -rfv ${{ matrix.variable }}_commit.txt
5858
- name: Create Pull Request
59-
uses: peter-evans/create-pull-request@v6
59+
uses: peter-evans/create-pull-request@v7
6060
with:
6161
token: ${{ secrets.UPDATE_BOT_TOKEN }}
6262
push-to-fork: ci-forks/LocalAI

.github/workflows/bump_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run: |
1818
bash .github/bump_docs.sh ${{ matrix.repository }}
1919
- name: Create Pull Request
20-
uses: peter-evans/create-pull-request@v6
20+
uses: peter-evans/create-pull-request@v7
2121
with:
2222
token: ${{ secrets.UPDATE_BOT_TOKEN }}
2323
push-to-fork: ci-forks/LocalAI

.github/workflows/checksum_checker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
sudo chmod 777 /hf_cache
3737
bash .github/checksum_checker.sh gallery/index.yaml
3838
- name: Create Pull Request
39-
uses: peter-evans/create-pull-request@v6
39+
uses: peter-evans/create-pull-request@v7
4040
with:
4141
token: ${{ secrets.UPDATE_BOT_TOKEN }}
4242
push-to-fork: ci-forks/LocalAI

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ jobs:
294294
export C_INCLUDE_PATH=/usr/local/include
295295
export CPLUS_INCLUDE_PATH=/usr/local/include
296296
export PATH=$PATH:$GOPATH/bin
297-
297+
export SKIP_GRPC_BACKEND=backend-assets/grpc/whisper
298298
make dist
299299
- uses: actions/upload-artifact@v4
300300
with:
@@ -327,7 +327,7 @@ jobs:
327327
cache: false
328328
- name: Dependencies
329329
run: |
330-
brew install protobuf grpc
330+
brew install protobuf grpc libomp llvm
331331
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@1958fcbe2ca8bd93af633f11e97d44e567e945af
332332
go install google.golang.org/protobuf/cmd/[email protected]
333333
- name: Build
@@ -336,7 +336,7 @@ jobs:
336336
export C_INCLUDE_PATH=/usr/local/include
337337
export CPLUS_INCLUDE_PATH=/usr/local/include
338338
export PATH=$PATH:$GOPATH/bin
339-
339+
export CC=/opt/homebrew/opt/llvm/bin/clang
340340
make dist
341341
- uses: actions/upload-artifact@v4
342342
with:

.github/workflows/secscan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
if: ${{ github.actor != 'dependabot[bot]' }}
1919
- name: Run Gosec Security Scanner
2020
if: ${{ github.actor != 'dependabot[bot]' }}
21-
uses: securego/gosec@master
21+
uses: securego/gosec@v2.21.2
2222
with:
2323
# we let the report trigger content trigger a failure using the GitHub Security features.
2424
args: '-no-fail -fmt sarif -out results.sarif ./...'

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,13 @@ jobs:
214214
run: go version
215215
- name: Dependencies
216216
run: |
217-
brew install protobuf grpc make protoc-gen-go protoc-gen-go-grpc
217+
brew install protobuf grpc make protoc-gen-go protoc-gen-go-grpc libomp llvm
218218
pip install --user --no-cache-dir grpcio-tools==1.64.1
219219
- name: Test
220220
run: |
221221
export C_INCLUDE_PATH=/usr/local/include
222222
export CPLUS_INCLUDE_PATH=/usr/local/include
223+
export CC=/opt/homebrew/opt/llvm/bin/clang
223224
# Used to run the newer GNUMake version from brew that supports --output-sync
224225
export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"
225226
BUILD_TYPE="GITHUB_CI_HAS_BROKEN_METAL" CMAKE_ARGS="-DGGML_F16C=OFF -DGGML_AVX512=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF" make --jobs 4 --output-sync=target test

.github/workflows/update_swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: |
2626
make protogen-go swagger
2727
- name: Create Pull Request
28-
uses: peter-evans/create-pull-request@v6
28+
uses: peter-evans/create-pull-request@v7
2929
with:
3030
token: ${{ secrets.UPDATE_BOT_TOKEN }}
3131
push-to-fork: ci-forks/LocalAI

Dockerfile

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ARG TARGETARCH
1313
ARG TARGETVARIANT
1414

1515
ENV DEBIAN_FRONTEND=noninteractive
16-
ENV EXTERNAL_GRPC_BACKENDS="coqui:/build/backend/python/coqui/run.sh,huggingface-embeddings:/build/backend/python/sentencetransformers/run.sh,transformers:/build/backend/python/transformers/run.sh,sentencetransformers:/build/backend/python/sentencetransformers/run.sh,rerankers:/build/backend/python/rerankers/run.sh,autogptq:/build/backend/python/autogptq/run.sh,bark:/build/backend/python/bark/run.sh,diffusers:/build/backend/python/diffusers/run.sh,exllama:/build/backend/python/exllama/run.sh,openvoice:/build/backend/python/openvoice/run.sh,vall-e-x:/build/backend/python/vall-e-x/run.sh,vllm:/build/backend/python/vllm/run.sh,mamba:/build/backend/python/mamba/run.sh,exllama2:/build/backend/python/exllama2/run.sh,transformers-musicgen:/build/backend/python/transformers-musicgen/run.sh,parler-tts:/build/backend/python/parler-tts/run.sh"
16+
ENV EXTERNAL_GRPC_BACKENDS="coqui:/build/backend/python/coqui/run.sh,huggingface-embeddings:/build/backend/python/sentencetransformers/run.sh,transformers:/build/backend/python/transformers/run.sh,sentencetransformers:/build/backend/python/sentencetransformers/run.sh,rerankers:/build/backend/python/rerankers/run.sh,autogptq:/build/backend/python/autogptq/run.sh,bark:/build/backend/python/bark/run.sh,diffusers:/build/backend/python/diffusers/run.sh,openvoice:/build/backend/python/openvoice/run.sh,vall-e-x:/build/backend/python/vall-e-x/run.sh,vllm:/build/backend/python/vllm/run.sh,mamba:/build/backend/python/mamba/run.sh,exllama2:/build/backend/python/exllama2/run.sh,transformers-musicgen:/build/backend/python/transformers-musicgen/run.sh,parler-tts:/build/backend/python/parler-tts/run.sh"
1717

1818

1919
RUN apt-get update && \
@@ -263,14 +263,20 @@ EOT
263263
# In most cases, builder is the image you should be using - however, this can save build time if one just needs to copy backend-assets/grpc/stablediffusion and nothing else.
264264
FROM builder-base AS builder-sd
265265

266-
COPY . .
267-
COPY .git .
268-
269-
RUN make prepare
270-
271-
272-
# stablediffusion does not tolerate a newer version of abseil, build it first
273-
RUN GRPC_BACKENDS=backend-assets/grpc/stablediffusion make build
266+
# stablediffusion does not tolerate a newer version of abseil, copy only over enough elements to build it
267+
COPY Makefile .
268+
COPY go.mod .
269+
COPY go.sum .
270+
COPY backend/backend.proto ./backend/backend.proto
271+
COPY backend/go/image/stablediffusion ./backend/go/image/stablediffusion
272+
COPY pkg/grpc ./pkg/grpc
273+
COPY pkg/stablediffusion ./pkg/stablediffusion
274+
RUN git init
275+
RUN make sources/go-stable-diffusion
276+
RUN touch prepare-sources
277+
278+
# Actually build the backend
279+
RUN GRPC_BACKENDS=backend-assets/grpc/stablediffusion make backend-assets/grpc/stablediffusion
274280

275281
###################################
276282
###################################
@@ -285,8 +291,20 @@ COPY --from=grpc /opt/grpc /usr/local
285291
# Rebuild with defaults backends
286292
WORKDIR /build
287293

294+
COPY . .
295+
COPY .git .
296+
297+
RUN make prepare
298+
288299
## Build the binary
289-
RUN make build
300+
## If it's CUDA, we want to skip some of the llama-compat backends to save space
301+
## We only leave the most CPU-optimized variant and the fallback for the cublas build
302+
## (both will use CUDA for the actual computation)
303+
RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
304+
SKIP_GRPC_BACKEND="backend-assets/grpc/llama-cpp-avx backend-assets/grpc/llama-cpp-avx2" make build; \
305+
else \
306+
make build; \
307+
fi
290308

291309
RUN if [ ! -d "/build/sources/go-piper/piper-phonemize/pi/lib/" ]; then \
292310
mkdir -p /build/sources/go-piper/piper-phonemize/pi/lib/ \
@@ -400,9 +418,6 @@ RUN if [[ ( "${EXTRA_BACKENDS}" =~ "coqui" || -z "${EXTRA_BACKENDS}" ) && "$IMAG
400418
; fi && \
401419
if [[ ( "${EXTRA_BACKENDS}" =~ "transformers-musicgen" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
402420
make -C backend/python/transformers-musicgen \
403-
; fi && \
404-
if [[ ( "${EXTRA_BACKENDS}" =~ "exllama1" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
405-
make -C backend/python/exllama \
406421
; fi
407422

408423
RUN if [[ ( "${EXTRA_BACKENDS}" =~ "vall-e-x" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \

Makefile

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ DETECT_LIBS?=true
88
# llama.cpp versions
99
GOLLAMA_REPO?=https://github.com/go-skynet/go-llama.cpp
1010
GOLLAMA_VERSION?=2b57a8ae43e4699d3dc5d1496a1ccd42922993be
11-
CPPLLAMA_VERSION?=2f3c1466ff46a2413b0e363a5005c46538186ee6
11+
CPPLLAMA_VERSION?=23e0d70bacaaca1429d365a44aa9e7434f17823b
1212

1313
# go-rwkv version
1414
RWKV_REPO?=https://github.com/donomii/go-rwkv.cpp
1515
RWKV_VERSION?=661e7ae26d442f5cfebd2a0881b44e8c55949ec6
1616

1717
# whisper.cpp version
1818
WHISPER_REPO?=https://github.com/ggerganov/whisper.cpp
19-
WHISPER_CPP_VERSION?=d65786ea540a5aef21f67cacfa6f134097727780
19+
WHISPER_CPP_VERSION?=049b3a0e53c8a8e4c4576c06a1a4fccf0063a73f
2020

2121
# bert.cpp version
2222
BERT_REPO?=https://github.com/go-skynet/go-bert.cpp
@@ -534,10 +534,10 @@ protogen-go-clean:
534534
$(RM) bin/*
535535

536536
.PHONY: protogen-python
537-
protogen-python: autogptq-protogen bark-protogen coqui-protogen diffusers-protogen exllama-protogen exllama2-protogen mamba-protogen rerankers-protogen sentencetransformers-protogen transformers-protogen parler-tts-protogen transformers-musicgen-protogen vall-e-x-protogen vllm-protogen openvoice-protogen
537+
protogen-python: autogptq-protogen bark-protogen coqui-protogen diffusers-protogen exllama2-protogen mamba-protogen rerankers-protogen sentencetransformers-protogen transformers-protogen parler-tts-protogen transformers-musicgen-protogen vall-e-x-protogen vllm-protogen openvoice-protogen
538538

539539
.PHONY: protogen-python-clean
540-
protogen-python-clean: autogptq-protogen-clean bark-protogen-clean coqui-protogen-clean diffusers-protogen-clean exllama-protogen-clean exllama2-protogen-clean mamba-protogen-clean sentencetransformers-protogen-clean rerankers-protogen-clean transformers-protogen-clean transformers-musicgen-protogen-clean parler-tts-protogen-clean vall-e-x-protogen-clean vllm-protogen-clean openvoice-protogen-clean
540+
protogen-python-clean: autogptq-protogen-clean bark-protogen-clean coqui-protogen-clean diffusers-protogen-clean exllama2-protogen-clean mamba-protogen-clean sentencetransformers-protogen-clean rerankers-protogen-clean transformers-protogen-clean transformers-musicgen-protogen-clean parler-tts-protogen-clean vall-e-x-protogen-clean vllm-protogen-clean openvoice-protogen-clean
541541

542542
.PHONY: autogptq-protogen
543543
autogptq-protogen:
@@ -571,14 +571,6 @@ diffusers-protogen:
571571
diffusers-protogen-clean:
572572
$(MAKE) -C backend/python/diffusers protogen-clean
573573

574-
.PHONY: exllama-protogen
575-
exllama-protogen:
576-
$(MAKE) -C backend/python/exllama protogen
577-
578-
.PHONY: exllama-protogen-clean
579-
exllama-protogen-clean:
580-
$(MAKE) -C backend/python/exllama protogen-clean
581-
582574
.PHONY: exllama2-protogen
583575
exllama2-protogen:
584576
$(MAKE) -C backend/python/exllama2 protogen
@@ -675,7 +667,6 @@ prepare-extra-conda-environments: protogen-python
675667
$(MAKE) -C backend/python/parler-tts
676668
$(MAKE) -C backend/python/vall-e-x
677669
$(MAKE) -C backend/python/openvoice
678-
$(MAKE) -C backend/python/exllama
679670
$(MAKE) -C backend/python/exllama2
680671

681672
prepare-test-extra: protogen-python
@@ -846,7 +837,7 @@ endif
846837

847838
backend-assets/grpc/whisper: sources/whisper.cpp sources/whisper.cpp/libwhisper.a backend-assets/grpc
848839
CGO_LDFLAGS="$(CGO_LDFLAGS) $(CGO_LDFLAGS_WHISPER)" C_INCLUDE_PATH="$(CURDIR)/sources/whisper.cpp/include:$(CURDIR)/sources/whisper.cpp/ggml/include" LIBRARY_PATH=$(CURDIR)/sources/whisper.cpp \
849-
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/whisper ./backend/go/transcribe/
840+
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/whisper ./backend/go/transcribe/whisper
850841
ifneq ($(UPX),)
851842
$(UPX) backend-assets/grpc/whisper
852843
endif

0 commit comments

Comments
 (0)