Skip to content

Commit 4c145b0

Browse files
authored
Merge branch 'master' into ci/public-runner
2 parents 96c080c + eef80b9 commit 4c145b0

File tree

85 files changed

+762
-1501
lines changed

Some content is hidden

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

85 files changed

+762
-1501
lines changed

.devcontainer/docker-compose-devcontainer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
args:
88
- FFMPEG=true
99
- IMAGE_TYPE=extras
10-
- GO_TAGS=stablediffusion p2p tts
10+
- GO_TAGS=p2p tts
1111
env_file:
1212
- ../.env
1313
ports:

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
## Uncomment and set to true to enable rebuilding from source
3939
# REBUILD=true
4040

41-
## Enable go tags, available: stablediffusion, tts
42-
## stablediffusion: image generation with stablediffusion
41+
## Enable go tags, available: p2p, tts
42+
## p2p: enable distributed inferencing
4343
## tts: enables text-to-speech with go-piper
4444
## (requires REBUILD=true)
4545
#
46-
# GO_TAGS=stablediffusion
46+
# GO_TAGS=p2p
4747

4848
## Path where to store generated images
4949
# LOCALAI_IMAGE_PATH=/tmp/generated/images

.github/workflows/release.yaml

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -237,40 +237,7 @@ jobs:
237237
detached: true
238238
connect-timeout-seconds: 180
239239
limit-access-to-actor: true
240-
build-stablediffusion:
241-
runs-on: ubuntu-latest
242-
steps:
243-
- name: Clone
244-
uses: actions/checkout@v4
245-
with:
246-
submodules: true
247-
- uses: actions/setup-go@v5
248-
with:
249-
go-version: '1.21.x'
250-
cache: false
251-
- name: Dependencies
252-
run: |
253-
sudo apt-get update
254-
sudo apt-get install -y --no-install-recommends libopencv-dev protobuf-compiler ccache upx-ucl
255-
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@1958fcbe2ca8bd93af633f11e97d44e567e945af
256-
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2
257-
- name: Build stablediffusion
258-
run: |
259-
export PATH=$PATH:$GOPATH/bin
260-
make backend-assets/grpc/stablediffusion
261-
mkdir -p release && cp backend-assets/grpc/stablediffusion release
262-
env:
263-
GO_TAGS: stablediffusion
264-
- uses: actions/upload-artifact@v4
265-
with:
266-
name: stablediffusion
267-
path: release/
268-
- name: Release
269-
uses: softprops/action-gh-release@v2
270-
if: startsWith(github.ref, 'refs/tags/')
271-
with:
272-
files: |
273-
release/*
240+
274241

275242
build-macOS-x86_64:
276243
runs-on: macos-13

.github/workflows/test-extra.yml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -78,57 +78,6 @@ jobs:
7878
make --jobs=5 --output-sync=target -C backend/python/diffusers
7979
make --jobs=5 --output-sync=target -C backend/python/diffusers test
8080
81-
tests-parler-tts:
82-
runs-on: ubuntu-latest
83-
steps:
84-
- name: Clone
85-
uses: actions/checkout@v4
86-
with:
87-
submodules: true
88-
- name: Dependencies
89-
run: |
90-
sudo apt-get update
91-
sudo apt-get install build-essential ffmpeg
92-
# Install UV
93-
curl -LsSf https://astral.sh/uv/install.sh | sh
94-
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
95-
sudo apt-get install -y libopencv-dev
96-
pip install --user --no-cache-dir grpcio-tools==1.64.1
97-
98-
- name: Test parler-tts
99-
run: |
100-
make --jobs=5 --output-sync=target -C backend/python/parler-tts
101-
make --jobs=5 --output-sync=target -C backend/python/parler-tts test
102-
- name: Setup tmate session if tests fail
103-
if: ${{ failure() }}
104-
uses: mxschmitt/action-tmate@v3.19
105-
with:
106-
detached: true
107-
connect-timeout-seconds: 180
108-
limit-access-to-actor: true
109-
110-
tests-openvoice:
111-
runs-on: ubuntu-latest
112-
steps:
113-
- name: Clone
114-
uses: actions/checkout@v4
115-
with:
116-
submodules: true
117-
- name: Dependencies
118-
run: |
119-
sudo apt-get update
120-
sudo apt-get install build-essential ffmpeg
121-
# Install UV
122-
curl -LsSf https://astral.sh/uv/install.sh | sh
123-
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
124-
sudo apt-get install -y libopencv-dev
125-
pip install --user --no-cache-dir grpcio-tools==1.64.1
126-
127-
- name: Test openvoice
128-
run: |
129-
make --jobs=5 --output-sync=target -C backend/python/openvoice
130-
make --jobs=5 --output-sync=target -C backend/python/openvoice test
131-
13281
# tests-transformers-musicgen:
13382
# runs-on: ubuntu-latest
13483
# steps:

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ jobs:
105105
# Pre-build piper before we start tests in order to have shared libraries in place
106106
make sources/go-piper && \
107107
GO_TAGS="tts" make -C sources/go-piper piper.o && \
108-
sudo cp -rfv sources/go-piper/piper-phonemize/pi/lib/. /usr/lib/ && \
109-
# Pre-build stable diffusion before we install a newer version of abseil (not compatible with stablediffusion-ncn)
110-
PATH="$PATH:/root/go/bin" GO_TAGS="stablediffusion tts" GRPC_BACKENDS=backend-assets/grpc/stablediffusion make build
108+
sudo cp -rfv sources/go-piper/piper-phonemize/pi/lib/. /usr/lib/
111109
env:
112110
CUDA_VERSION: 12-4
113111
- name: Cache grpc
@@ -129,7 +127,7 @@ jobs:
129127
cd grpc && cd cmake/build && sudo make --jobs 5 install
130128
- name: Test
131129
run: |
132-
PATH="$PATH:/root/go/bin" GO_TAGS="stablediffusion tts" make --jobs 5 --output-sync=target test
130+
PATH="$PATH:/root/go/bin" GO_TAGS="tts" make --jobs 5 --output-sync=target test
133131
- name: Setup tmate session if tests fail
134132
if: ${{ failure() }}
135133
uses: mxschmitt/action-tmate@v3.19

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"LOCALAI_P2P": "true",
2727
"LOCALAI_FEDERATED": "true"
2828
},
29-
"buildFlags": ["-tags", "stablediffusion p2p tts", "-v"],
29+
"buildFlags": ["-tags", "p2p tts", "-v"],
3030
"envFile": "${workspaceFolder}/.env",
3131
"cwd": "${workspaceRoot}"
3232
}

Dockerfile

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ ARG TARGETARCH
1515
ARG TARGETVARIANT
1616

1717
ENV DEBIAN_FRONTEND=noninteractive
18-
ENV EXTERNAL_GRPC_BACKENDS="coqui:/build/backend/python/coqui/run.sh,transformers:/build/backend/python/transformers/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,kokoro:/build/backend/python/kokoro/run.sh,vllm:/build/backend/python/vllm/run.sh,mamba:/build/backend/python/mamba/run.sh,exllama2:/build/backend/python/exllama2/run.sh,parler-tts:/build/backend/python/parler-tts/run.sh"
19-
18+
ENV EXTERNAL_GRPC_BACKENDS="coqui:/build/backend/python/coqui/run.sh,transformers:/build/backend/python/transformers/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,faster-whisper:/build/backend/python/faster-whisper/run.sh,kokoro:/build/backend/python/kokoro/run.sh,vllm:/build/backend/python/vllm/run.sh,exllama2:/build/backend/python/exllama2/run.sh"
2019

2120
RUN apt-get update && \
2221
apt-get install -y --no-install-recommends \
@@ -69,14 +68,10 @@ ENV PATH=/opt/rocm/bin:${PATH}
6968
# OpenBLAS requirements and stable diffusion
7069
RUN apt-get update && \
7170
apt-get install -y --no-install-recommends \
72-
libopenblas-dev \
73-
libopencv-dev && \
71+
libopenblas-dev && \
7472
apt-get clean && \
7573
rm -rf /var/lib/apt/lists/*
7674

77-
# Set up OpenCV
78-
RUN ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
79-
8075
WORKDIR /build
8176

8277
###################################
@@ -251,7 +246,7 @@ RUN git clone --recurse-submodules --jobs 4 -b ${GRPC_VERSION} --depth 1 --shall
251246

252247
FROM requirements-drivers AS builder-base
253248

254-
ARG GO_TAGS="stablediffusion tts p2p"
249+
ARG GO_TAGS="tts p2p"
255250
ARG GRPC_BACKENDS
256251
ARG MAKEFLAGS
257252
ARG LD_FLAGS="-s -w"
@@ -285,35 +280,12 @@ RUN <<EOT bash
285280
fi
286281
EOT
287282

288-
289-
###################################
290-
###################################
291-
292-
# This first portion of builder holds the layers specifically used to build backend-assets/grpc/stablediffusion
293-
# 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.
294-
FROM builder-base AS builder-sd
295-
296-
# stablediffusion does not tolerate a newer version of abseil, copy only over enough elements to build it
297-
COPY Makefile .
298-
COPY go.mod .
299-
COPY go.sum .
300-
COPY backend/backend.proto ./backend/backend.proto
301-
COPY backend/go/image/stablediffusion ./backend/go/image/stablediffusion
302-
COPY pkg/grpc ./pkg/grpc
303-
COPY pkg/stablediffusion ./pkg/stablediffusion
304-
RUN git init
305-
RUN make sources/go-stable-diffusion
306-
RUN touch prepare-sources
307-
308-
# Actually build the backend
309-
RUN GRPC_BACKENDS=backend-assets/grpc/stablediffusion make backend-assets/grpc/stablediffusion
310-
311283
###################################
312284
###################################
313285

314286
# The builder target compiles LocalAI. This target is not the target that will be uploaded to the registry.
315287
# Adjustments to the build process should likely be made here.
316-
FROM builder-sd AS builder
288+
FROM builder-base AS builder
317289

318290
# Install the pre-built GRPC
319291
COPY --from=grpc /opt/grpc /usr/local
@@ -353,8 +325,6 @@ ARG FFMPEG
353325

354326
COPY --from=grpc /opt/grpc /usr/local
355327

356-
COPY --from=builder-sd /build/backend-assets/grpc/stablediffusion /build/backend-assets/grpc/stablediffusion
357-
358328
COPY .devcontainer-scripts /.devcontainer-scripts
359329

360330
# Add FFmpeg
@@ -427,9 +397,6 @@ COPY --from=builder /build/local-ai ./
427397
# Copy shared libraries for piper
428398
COPY --from=builder /build/sources/go-piper/piper-phonemize/pi/lib/* /usr/lib/
429399

430-
# do not let stablediffusion rebuild (requires an older version of absl)
431-
COPY --from=builder-sd /build/backend-assets/grpc/stablediffusion ./backend-assets/grpc/stablediffusion
432-
433400
# Change the shell to bash so we can use [[ tests below
434401
SHELL ["/bin/bash", "-c"]
435402
# We try to strike a balance between individual layer size (as that affects total push time) and total image size
@@ -443,8 +410,8 @@ RUN if [[ ( "${IMAGE_TYPE}" == "extras ")]]; then \
443410
RUN if [[ ( "${EXTRA_BACKENDS}" =~ "coqui" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
444411
make -C backend/python/coqui \
445412
; fi && \
446-
if [[ ( "${EXTRA_BACKENDS}" =~ "parler-tts" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
447-
make -C backend/python/parler-tts \
413+
if [[ ( "${EXTRA_BACKENDS}" =~ "faster-whisper" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
414+
make -C backend/python/faster-whisper \
448415
; fi && \
449416
if [[ ( "${EXTRA_BACKENDS}" =~ "diffusers" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
450417
make -C backend/python/diffusers \
@@ -453,9 +420,6 @@ RUN if [[ ( "${EXTRA_BACKENDS}" =~ "coqui" || -z "${EXTRA_BACKENDS}" ) && "$IMAG
453420
RUN if [[ ( "${EXTRA_BACKENDS}" =~ "kokoro" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
454421
make -C backend/python/kokoro \
455422
; fi && \
456-
if [[ ( "${EXTRA_BACKENDS}" =~ "openvoice" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
457-
make -C backend/python/openvoice \
458-
; fi && \
459423
if [[ ( "${EXTRA_BACKENDS}" =~ "exllama2" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
460424
make -C backend/python/exllama2 \
461425
; fi && \
@@ -474,9 +438,6 @@ RUN if [[ ( "${EXTRA_BACKENDS}" =~ "vllm" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE
474438
; fi && \
475439
if [[ ( "${EXTRA_BACKENDS}" =~ "rerankers" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
476440
make -C backend/python/rerankers \
477-
; fi && \
478-
if [[ ( "${EXTRA_BACKENDS}" =~ "mamba" || -z "${EXTRA_BACKENDS}" ) && "$IMAGE_TYPE" == "extras" ]]; then \
479-
make -C backend/python/mamba \
480441
; fi
481442

482443
# Make sure the models directory exists

0 commit comments

Comments
 (0)