2023-05-23 15:12:48 +00:00
|
|
|
name: Build and Release
|
|
|
|
|
2024-05-14 17:40:18 +00:00
|
|
|
on:
|
2024-04-13 11:30:40 +00:00
|
|
|
- push
|
|
|
|
- pull_request
|
2023-05-23 15:12:48 +00:00
|
|
|
|
2024-03-29 21:32:40 +00:00
|
|
|
env:
|
2024-05-21 12:33:47 +00:00
|
|
|
GRPC_VERSION: v1.64.0
|
2024-03-29 21:32:40 +00:00
|
|
|
|
2023-05-23 19:47:47 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
2023-12-26 18:19:37 +00:00
|
|
|
concurrency:
|
|
|
|
group: ci-releases-${{ github.head_ref || github.ref }}-${{ github.repository }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-05-23 15:12:48 +00:00
|
|
|
jobs:
|
|
|
|
build-linux:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-06-05 06:44:15 +00:00
|
|
|
- name: Release space from worker
|
|
|
|
run: |
|
|
|
|
echo "Listing top largest packages"
|
|
|
|
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
|
|
|
|
head -n 30 <<< "${pkgs}"
|
|
|
|
echo
|
|
|
|
df -h
|
|
|
|
echo
|
|
|
|
sudo apt-get remove -y '^llvm-.*|^libllvm.*' || true
|
|
|
|
sudo apt-get remove --auto-remove android-sdk-platform-tools || true
|
|
|
|
sudo apt-get purge --auto-remove android-sdk-platform-tools || true
|
|
|
|
sudo rm -rf /usr/local/lib/android
|
|
|
|
sudo apt-get remove -y '^dotnet-.*|^aspnetcore-.*' || true
|
|
|
|
sudo rm -rf /usr/share/dotnet
|
|
|
|
sudo apt-get remove -y '^mono-.*' || true
|
|
|
|
sudo apt-get remove -y '^ghc-.*' || true
|
|
|
|
sudo apt-get remove -y '.*jdk.*|.*jre.*' || true
|
|
|
|
sudo apt-get remove -y 'php.*' || true
|
|
|
|
sudo apt-get remove -y hhvm powershell firefox monodoc-manual msbuild || true
|
|
|
|
sudo apt-get remove -y '^google-.*' || true
|
|
|
|
sudo apt-get remove -y azure-cli || true
|
|
|
|
sudo apt-get remove -y '^mongo.*-.*|^postgresql-.*|^mysql-.*|^mssql-.*' || true
|
|
|
|
sudo apt-get remove -y '^gfortran-.*' || true
|
|
|
|
sudo apt-get remove -y microsoft-edge-stable || true
|
|
|
|
sudo apt-get remove -y firefox || true
|
|
|
|
sudo apt-get remove -y powershell || true
|
|
|
|
sudo apt-get remove -y r-base-core || true
|
|
|
|
sudo apt-get autoremove -y
|
|
|
|
sudo apt-get clean
|
|
|
|
echo
|
|
|
|
echo "Listing top largest packages"
|
|
|
|
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
|
|
|
|
head -n 30 <<< "${pkgs}"
|
|
|
|
echo
|
|
|
|
sudo rm -rfv build || true
|
|
|
|
sudo rm -rf /usr/share/dotnet || true
|
|
|
|
sudo rm -rf /opt/ghc || true
|
|
|
|
sudo rm -rf "/usr/local/share/boost" || true
|
|
|
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true
|
|
|
|
df -h
|
2023-05-23 15:12:48 +00:00
|
|
|
- name: Clone
|
2023-10-21 06:55:44 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-05-29 21:11:29 +00:00
|
|
|
with:
|
2023-05-23 15:12:48 +00:00
|
|
|
submodules: true
|
2024-04-11 13:10:32 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-08-23 23:18:58 +00:00
|
|
|
with:
|
2024-03-29 21:32:40 +00:00
|
|
|
go-version: '1.21.x'
|
|
|
|
cache: false
|
2023-05-23 15:12:48 +00:00
|
|
|
- name: Dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2024-05-14 23:17:02 +00:00
|
|
|
sudo apt-get install build-essential ffmpeg protobuf-compiler ccache
|
2024-02-13 08:35:39 +00:00
|
|
|
- name: Install CUDA Dependencies
|
|
|
|
run: |
|
|
|
|
curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
|
|
|
|
sudo dpkg -i cuda-keyring_1.1-1_all.deb
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y cuda-nvcc-${CUDA_VERSION} libcublas-dev-${CUDA_VERSION}
|
2024-05-14 17:40:18 +00:00
|
|
|
env:
|
|
|
|
CUDA_VERSION: 12-3
|
2024-06-05 06:44:15 +00:00
|
|
|
- name: "Install Hipblas"
|
|
|
|
env:
|
|
|
|
ROCM_VERSION: "6.1"
|
|
|
|
AMDGPU_VERSION: "6.1"
|
|
|
|
run: |
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
sudo apt-get update
|
|
|
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl libnuma-dev gnupg
|
|
|
|
|
|
|
|
curl -sL https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
|
|
|
|
|
|
|
|
printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ jammy main" | sudo tee /etc/apt/sources.list.d/rocm.list
|
|
|
|
|
|
|
|
printf "deb [arch=amd64] https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/amdgpu.list
|
|
|
|
printf 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600
|
|
|
|
sudo apt-get update
|
|
|
|
|
|
|
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|
|
|
hipblas-dev rocm-dev \
|
|
|
|
rocblas-dev
|
|
|
|
|
|
|
|
sudo apt-get clean
|
|
|
|
sudo rm -rf /var/lib/apt/lists/*
|
|
|
|
sudo ldconfig
|
2024-01-05 22:16:33 +00:00
|
|
|
- name: Cache grpc
|
|
|
|
id: cache-grpc
|
2024-04-11 14:35:27 +00:00
|
|
|
uses: actions/cache@v4
|
2024-01-05 22:16:33 +00:00
|
|
|
with:
|
|
|
|
path: grpc
|
2024-03-29 21:32:40 +00:00
|
|
|
key: ${{ runner.os }}-grpc-${{ env.GRPC_VERSION }}
|
2024-01-05 22:16:33 +00:00
|
|
|
- name: Build grpc
|
|
|
|
if: steps.cache-grpc.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
2024-03-29 21:32:40 +00:00
|
|
|
git clone --recurse-submodules -b ${{ env.GRPC_VERSION }} --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
|
2024-01-05 22:16:33 +00:00
|
|
|
cd grpc && mkdir -p cmake/build && cd cmake/build && cmake -DgRPC_INSTALL=ON \
|
|
|
|
-DgRPC_BUILD_TESTS=OFF \
|
2024-03-29 21:32:40 +00:00
|
|
|
../.. && sudo make --jobs 5 --output-sync=target
|
2024-01-05 22:16:33 +00:00
|
|
|
- name: Install gRPC
|
|
|
|
run: |
|
2024-03-29 21:32:40 +00:00
|
|
|
cd grpc && cd cmake/build && sudo make --jobs 5 --output-sync=target install
|
2023-05-23 15:12:48 +00:00
|
|
|
- name: Build
|
|
|
|
id: build
|
|
|
|
run: |
|
2024-06-01 16:59:15 +00:00
|
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@8ba23be9613c672d40ae261d2a1335d639bdd59b
|
|
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.0
|
2024-04-13 11:30:40 +00:00
|
|
|
export PATH=$PATH:$GOPATH/bin
|
2024-05-14 17:40:18 +00:00
|
|
|
export PATH=/usr/local/cuda/bin:$PATH
|
2024-06-05 06:44:15 +00:00
|
|
|
export PATH=/opt/rocm/bin:$PATH
|
feat(llama.cpp): Totally decentralized, private, distributed, p2p inference (#2343)
* feat(llama.cpp): Enable decentralized, distributed inference
As https://github.com/mudler/LocalAI/pull/2324 introduced distributed inferencing thanks to
@rgerganov implementation in https://github.com/ggerganov/llama.cpp/pull/6829 in upstream llama.cpp, now
it is possible to distribute the workload to remote llama.cpp gRPC server.
This changeset now uses mudler/edgevpn to establish a secure, distributed network between the nodes using a shared token.
The token is generated automatically when starting the server with the `--p2p` flag, and can be used by starting the workers
with `local-ai worker p2p-llama-cpp-rpc` by passing the token via environment variable (TOKEN) or with args (--token).
As per how mudler/edgevpn works, a network is established between the server and the workers with dht and mdns discovery protocols,
the llama.cpp rpc server is automatically started and exposed to the underlying p2p network so the API server can connect on.
When the HTTP server is started, it will discover the workers in the network and automatically create the port-forwards to the service locally.
Then llama.cpp is configured to use the services.
This feature is behind the "p2p" GO_FLAGS
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* go mod tidy
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* ci: add p2p tag
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* better message
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
---------
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2024-05-20 17:17:59 +00:00
|
|
|
GO_TAGS=p2p make dist
|
2024-04-11 14:44:02 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2023-05-23 15:12:48 +00:00
|
|
|
with:
|
2024-05-14 17:40:18 +00:00
|
|
|
name: LocalAI-linux
|
2023-05-23 15:12:48 +00:00
|
|
|
path: release/
|
|
|
|
- name: Release
|
2024-04-15 20:52:39 +00:00
|
|
|
uses: softprops/action-gh-release@v2
|
2023-05-23 15:12:48 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
release/*
|
|
|
|
|
2024-02-25 23:06:18 +00:00
|
|
|
build-stablediffusion:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Clone
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: true
|
2024-04-11 13:10:32 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2024-02-25 23:06:18 +00:00
|
|
|
with:
|
2024-03-29 21:32:40 +00:00
|
|
|
go-version: '1.21.x'
|
|
|
|
cache: false
|
2024-02-25 23:06:18 +00:00
|
|
|
- name: Dependencies
|
|
|
|
run: |
|
2024-05-31 16:08:39 +00:00
|
|
|
sudo apt-get update
|
2024-05-14 23:17:02 +00:00
|
|
|
sudo apt-get install -y --no-install-recommends libopencv-dev protobuf-compiler ccache
|
2024-06-01 16:59:15 +00:00
|
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@8ba23be9613c672d40ae261d2a1335d639bdd59b
|
|
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.0
|
2024-02-25 23:06:18 +00:00
|
|
|
- name: Build stablediffusion
|
|
|
|
run: |
|
2024-04-13 11:30:40 +00:00
|
|
|
export PATH=$PATH:$GOPATH/bin
|
2024-02-25 23:06:18 +00:00
|
|
|
make backend-assets/grpc/stablediffusion
|
|
|
|
mkdir -p release && cp backend-assets/grpc/stablediffusion release
|
2024-05-23 06:34:37 +00:00
|
|
|
env:
|
|
|
|
GO_TAGS: stablediffusion
|
2024-04-11 14:44:02 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2024-02-25 23:06:18 +00:00
|
|
|
with:
|
|
|
|
name: stablediffusion
|
|
|
|
path: release/
|
2024-05-25 07:33:50 +00:00
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v2
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
release/*
|
2024-02-25 23:06:18 +00:00
|
|
|
|
2024-04-11 17:22:30 +00:00
|
|
|
build-macOS-arm64:
|
|
|
|
runs-on: macos-14
|
|
|
|
steps:
|
|
|
|
- name: Clone
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: '1.21.x'
|
|
|
|
cache: false
|
|
|
|
- name: Dependencies
|
|
|
|
run: |
|
|
|
|
brew install protobuf grpc
|
2024-06-01 16:59:15 +00:00
|
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@8ba23be9613c672d40ae261d2a1335d639bdd59b
|
|
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.0
|
2024-04-11 17:22:30 +00:00
|
|
|
- name: Build
|
|
|
|
id: build
|
|
|
|
run: |
|
|
|
|
export C_INCLUDE_PATH=/usr/local/include
|
|
|
|
export CPLUS_INCLUDE_PATH=/usr/local/include
|
2024-04-13 11:30:40 +00:00
|
|
|
export PATH=$PATH:$GOPATH/bin
|
feat(llama.cpp): Totally decentralized, private, distributed, p2p inference (#2343)
* feat(llama.cpp): Enable decentralized, distributed inference
As https://github.com/mudler/LocalAI/pull/2324 introduced distributed inferencing thanks to
@rgerganov implementation in https://github.com/ggerganov/llama.cpp/pull/6829 in upstream llama.cpp, now
it is possible to distribute the workload to remote llama.cpp gRPC server.
This changeset now uses mudler/edgevpn to establish a secure, distributed network between the nodes using a shared token.
The token is generated automatically when starting the server with the `--p2p` flag, and can be used by starting the workers
with `local-ai worker p2p-llama-cpp-rpc` by passing the token via environment variable (TOKEN) or with args (--token).
As per how mudler/edgevpn works, a network is established between the server and the workers with dht and mdns discovery protocols,
the llama.cpp rpc server is automatically started and exposed to the underlying p2p network so the API server can connect on.
When the HTTP server is started, it will discover the workers in the network and automatically create the port-forwards to the service locally.
Then llama.cpp is configured to use the services.
This feature is behind the "p2p" GO_FLAGS
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* go mod tidy
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* ci: add p2p tag
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
* better message
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
---------
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2024-05-20 17:17:59 +00:00
|
|
|
GO_TAGS=p2p make dist
|
2024-04-11 17:22:30 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2024-05-05 15:20:51 +00:00
|
|
|
name: LocalAI-MacOS-arm64
|
2024-04-11 17:22:30 +00:00
|
|
|
path: release/
|
|
|
|
- name: Release
|
2024-04-15 20:52:39 +00:00
|
|
|
uses: softprops/action-gh-release@v2
|
2024-04-11 17:22:30 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
release/*
|