mirror of
https://github.com/mudler/LocalAI.git
synced 2026-05-25 01:02:05 -04:00
Compare commits
1 Commits
enable_gpu
...
renovate/g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02397f6727 |
5
.env
5
.env
@@ -66,7 +66,4 @@ MODELS_PATH=/models
|
|||||||
### Python backends GRPC max workers
|
### Python backends GRPC max workers
|
||||||
### Default number of workers for GRPC Python backends.
|
### Default number of workers for GRPC Python backends.
|
||||||
### This actually controls wether a backend can process multiple requests or not.
|
### This actually controls wether a backend can process multiple requests or not.
|
||||||
# PYTHON_GRPC_MAX_WORKERS=1
|
# PYTHON_GRPC_MAX_WORKERS=1
|
||||||
|
|
||||||
### Define the number of parallel LLAMA.cpp workers (Defaults to 1)
|
|
||||||
# LLAMACPP_PARALLEL=1
|
|
||||||
5
.github/workflows/bump_deps.yaml
vendored
5
.github/workflows/bump_deps.yaml
vendored
@@ -12,9 +12,6 @@ jobs:
|
|||||||
- repository: "go-skynet/go-llama.cpp"
|
- repository: "go-skynet/go-llama.cpp"
|
||||||
variable: "GOLLAMA_VERSION"
|
variable: "GOLLAMA_VERSION"
|
||||||
branch: "master"
|
branch: "master"
|
||||||
- repository: "ggerganov/llama.cpp"
|
|
||||||
variable: "CPPLLAMA_VERSION"
|
|
||||||
branch: "master"
|
|
||||||
- repository: "go-skynet/go-ggml-transformers.cpp"
|
- repository: "go-skynet/go-ggml-transformers.cpp"
|
||||||
variable: "GOGGMLTRANSFORMERS_VERSION"
|
variable: "GOGGMLTRANSFORMERS_VERSION"
|
||||||
branch: "master"
|
branch: "master"
|
||||||
@@ -44,7 +41,7 @@ jobs:
|
|||||||
branch: "master"
|
branch: "master"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- name: Bump dependencies 🔧
|
- name: Bump dependencies 🔧
|
||||||
run: |
|
run: |
|
||||||
bash .github/bump_deps.sh ${{ matrix.repository }} ${{ matrix.branch }} ${{ matrix.variable }}
|
bash .github/bump_deps.sh ${{ matrix.repository }} ${{ matrix.branch }} ${{ matrix.variable }}
|
||||||
|
|||||||
94
.github/workflows/image.yml
vendored
94
.github/workflows/image.yml
vendored
@@ -14,21 +14,15 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
image-build:
|
docker:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- build-type: ''
|
- build-type: ''
|
||||||
#platforms: 'linux/amd64,linux/arm64'
|
platforms: 'linux/amd64,linux/arm64'
|
||||||
platforms: 'linux/amd64'
|
|
||||||
tag-latest: 'auto'
|
tag-latest: 'auto'
|
||||||
tag-suffix: ''
|
tag-suffix: ''
|
||||||
ffmpeg: ''
|
ffmpeg: ''
|
||||||
- build-type: ''
|
|
||||||
platforms: 'linux/amd64'
|
|
||||||
tag-latest: 'false'
|
|
||||||
tag-suffix: '-ffmpeg'
|
|
||||||
ffmpeg: 'true'
|
|
||||||
- build-type: 'cublas'
|
- build-type: 'cublas'
|
||||||
cuda-major-version: 11
|
cuda-major-version: 11
|
||||||
cuda-minor-version: 7
|
cuda-minor-version: 7
|
||||||
@@ -43,6 +37,11 @@ jobs:
|
|||||||
tag-latest: 'false'
|
tag-latest: 'false'
|
||||||
tag-suffix: '-cublas-cuda12'
|
tag-suffix: '-cublas-cuda12'
|
||||||
ffmpeg: ''
|
ffmpeg: ''
|
||||||
|
- build-type: ''
|
||||||
|
platforms: 'linux/amd64,linux/arm64'
|
||||||
|
tag-latest: 'false'
|
||||||
|
tag-suffix: '-ffmpeg'
|
||||||
|
ffmpeg: 'true'
|
||||||
- build-type: 'cublas'
|
- build-type: 'cublas'
|
||||||
cuda-major-version: 11
|
cuda-major-version: 11
|
||||||
cuda-minor-version: 7
|
cuda-minor-version: 7
|
||||||
@@ -58,54 +57,43 @@ jobs:
|
|||||||
tag-suffix: '-cublas-cuda12-ffmpeg'
|
tag-suffix: '-cublas-cuda12-ffmpeg'
|
||||||
ffmpeg: 'true'
|
ffmpeg: 'true'
|
||||||
|
|
||||||
runs-on: arc-runner-set
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Force Install GIT latest
|
- name: Release space from worker
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update \
|
echo "Listing top largest packages"
|
||||||
&& sudo apt-get install -y software-properties-common \
|
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
|
||||||
&& sudo apt-get update \
|
head -n 30 <<< "${pkgs}"
|
||||||
&& sudo add-apt-repository -y ppa:git-core/ppa \
|
echo
|
||||||
&& sudo apt-get update \
|
df -h
|
||||||
&& sudo apt-get install -y git
|
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 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
|
||||||
|
df -h
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
# - 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
|
|
||||||
# df -h
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
|||||||
18
.github/workflows/release.yaml
vendored
18
.github/workflows/release.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone
|
- name: Clone
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
@@ -29,12 +29,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install build-essential ffmpeg
|
sudo apt-get install build-essential ffmpeg
|
||||||
|
|
||||||
git clone --recurse-submodules -b v1.58.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
|
|
||||||
cd grpc && mkdir -p cmake/build && cd cmake/build && cmake -DgRPC_INSTALL=ON \
|
|
||||||
-DgRPC_BUILD_TESTS=OFF \
|
|
||||||
../.. && sudo make -j12 install
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
env:
|
env:
|
||||||
@@ -66,26 +60,18 @@ jobs:
|
|||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone
|
- name: Clone
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.21.0'
|
go-version: '>=1.21.0'
|
||||||
- name: Dependencies
|
|
||||||
run: |
|
|
||||||
git clone --recurse-submodules -b v1.58.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
|
|
||||||
cd grpc && mkdir -p cmake/build && cd cmake/build && cmake -DgRPC_INSTALL=ON \
|
|
||||||
-DgRPC_BUILD_TESTS=OFF \
|
|
||||||
../.. && make -j12 install && rm -rf grpc
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
env:
|
env:
|
||||||
CMAKE_ARGS: "${{ matrix.defines }}"
|
CMAKE_ARGS: "${{ matrix.defines }}"
|
||||||
BUILD_ID: "${{ matrix.build }}"
|
BUILD_ID: "${{ matrix.build }}"
|
||||||
run: |
|
run: |
|
||||||
export C_INCLUDE_PATH=/usr/local/include
|
|
||||||
export CPLUS_INCLUDE_PATH=/usr/local/include
|
|
||||||
make dist
|
make dist
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
63
.github/workflows/test-gpu.yml
vendored
63
.github/workflows/test-gpu.yml
vendored
@@ -1,63 +0,0 @@
|
|||||||
---
|
|
||||||
name: 'GPU tests'
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ci-gpu-tests-${{ github.head_ref || github.ref }}-${{ github.repository }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ubuntu-latest:
|
|
||||||
runs-on: gpu
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go-version: ['1.21.x']
|
|
||||||
steps:
|
|
||||||
- name: Clone
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Setup Go ${{ matrix.go-version }}
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
# You can test your matrix by printing the current Go version
|
|
||||||
- name: Display Go version
|
|
||||||
run: go version
|
|
||||||
- name: Dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y make wget
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
if [ ! -e /run/systemd/system ]; then
|
|
||||||
sudo mkdir /run/systemd/system
|
|
||||||
fi
|
|
||||||
sudo mkdir -p /host/tests/${{ github.head_ref || github.ref }}
|
|
||||||
sudo chmod -R 777 /host/tests/${{ github.head_ref || github.ref }}
|
|
||||||
make \
|
|
||||||
TEST_DIR="/host/tests/${{ github.head_ref || github.ref }}" \
|
|
||||||
BUILD_TYPE=cublas \
|
|
||||||
prepare-e2e run-e2e-image test-e2e
|
|
||||||
- name: Release space from worker ♻
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
sudo rm -rf build || true
|
|
||||||
sudo rm -rf bin || true
|
|
||||||
sudo rm -rf dist || true
|
|
||||||
sudo docker logs $(sudo docker ps -q --filter ancestor=localai-tests) > logs.txt
|
|
||||||
sudo cat logs.txt || true
|
|
||||||
sudo rm -rf logs.txt
|
|
||||||
make clean || true
|
|
||||||
make \
|
|
||||||
TEST_DIR="/host/tests/${{ github.head_ref || github.ref }}" \
|
|
||||||
teardown-e2e || true
|
|
||||||
sudo rm -rf /host/tests/${{ github.head_ref || github.ref }} || true
|
|
||||||
docker system prune -f -a --volumes || true
|
|
||||||
57
.github/workflows/test.yml
vendored
57
.github/workflows/test.yml
vendored
@@ -14,7 +14,7 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests-linux:
|
ubuntu-latest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
sudo rm -rfv build || true
|
sudo rm -rfv build || true
|
||||||
df -h
|
df -h
|
||||||
- name: Clone
|
- name: Clone
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup Go ${{ matrix.go-version }}
|
- name: Setup Go ${{ matrix.go-version }}
|
||||||
@@ -67,43 +67,38 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install build-essential ffmpeg
|
sudo apt-get install build-essential ffmpeg
|
||||||
curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg && \
|
|
||||||
sudo install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg && \
|
|
||||||
gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806 && \
|
|
||||||
sudo /bin/bash -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list' && \
|
|
||||||
sudo /bin/bash -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" | tee -a /etc/apt/sources.list.d/conda.list' && \
|
|
||||||
sudo apt-get update && \
|
|
||||||
sudo apt-get install -y conda
|
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch
|
sudo apt-get install -y ca-certificates cmake curl patch
|
||||||
sudo apt-get install -y libopencv-dev && sudo ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
|
sudo apt-get install -y libopencv-dev && sudo ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
|
||||||
|
sudo pip install -r extra/requirements.txt
|
||||||
sudo rm -rfv /usr/bin/conda || true
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/huggingface
|
|
||||||
|
|
||||||
# Pre-build piper before we start tests in order to have shared libraries in place
|
sudo mkdir /build && sudo chmod -R 777 /build && cd /build && \
|
||||||
make go-piper && \
|
curl -L "https://github.com/gabime/spdlog/archive/refs/tags/v1.11.0.tar.gz" | \
|
||||||
GO_TAGS="tts" make -C go-piper piper.o && \
|
tar -xzvf - && \
|
||||||
sudo cp -rfv go-piper/piper/build/pi/lib/. /usr/lib/ && \
|
mkdir -p "spdlog-1.11.0/build" && \
|
||||||
|
cd "spdlog-1.11.0/build" && \
|
||||||
# Pre-build stable diffusion before we install a newer version of abseil (not compatible with stablediffusion-ncn)
|
cmake .. && \
|
||||||
GO_TAGS="stablediffusion tts" GRPC_BACKENDS=backend-assets/grpc/stablediffusion make build
|
make -j8 && \
|
||||||
|
sudo cmake --install . --prefix /usr && mkdir -p "lib/Linux-$(uname -m)" && \
|
||||||
git clone --recurse-submodules -b v1.58.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
|
cd /build && \
|
||||||
cd grpc && mkdir -p cmake/build && cd cmake/build && cmake -DgRPC_INSTALL=ON \
|
mkdir -p "lib/Linux-$(uname -m)/piper_phonemize" && \
|
||||||
-DgRPC_BUILD_TESTS=OFF \
|
curl -L "https://github.com/rhasspy/piper-phonemize/releases/download/v1.0.0/libpiper_phonemize-amd64.tar.gz" | \
|
||||||
../.. && sudo make -j12 install
|
tar -C "lib/Linux-$(uname -m)/piper_phonemize" -xzvf - && ls -liah /build/lib/Linux-$(uname -m)/piper_phonemize/ && \
|
||||||
|
sudo cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /usr/lib/ && \
|
||||||
|
sudo ln -s /usr/lib/libpiper_phonemize.so /usr/lib/libpiper_phonemize.so.1 && \
|
||||||
|
sudo cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/include/. /usr/include/
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
GO_TAGS="stablediffusion tts" make test
|
ESPEAK_DATA="/build/lib/Linux-$(uname -m)/piper_phonemize/lib/espeak-ng-data" GO_TAGS="tts stablediffusion" make test
|
||||||
|
|
||||||
tests-apple:
|
macOS-latest:
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: ['1.21.x']
|
go-version: ['1.21.x']
|
||||||
steps:
|
steps:
|
||||||
- name: Clone
|
- name: Clone
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup Go ${{ matrix.go-version }}
|
- name: Setup Go ${{ matrix.go-version }}
|
||||||
@@ -113,14 +108,6 @@ jobs:
|
|||||||
# You can test your matrix by printing the current Go version
|
# You can test your matrix by printing the current Go version
|
||||||
- name: Display Go version
|
- name: Display Go version
|
||||||
run: go version
|
run: go version
|
||||||
- name: Dependencies
|
|
||||||
run: |
|
|
||||||
git clone --recurse-submodules -b v1.58.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
|
|
||||||
cd grpc && mkdir -p cmake/build && cd cmake/build && cmake -DgRPC_INSTALL=ON \
|
|
||||||
-DgRPC_BUILD_TESTS=OFF \
|
|
||||||
../.. && make -j12 install && rm -rf grpc
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
export C_INCLUDE_PATH=/usr/local/include
|
|
||||||
export CPLUS_INCLUDE_PATH=/usr/local/include
|
|
||||||
CMAKE_ARGS="-DLLAMA_F16C=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF" make test
|
CMAKE_ARGS="-DLLAMA_F16C=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF" make test
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,8 +10,6 @@ go-ggllm
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.a
|
*.a
|
||||||
get-sources
|
get-sources
|
||||||
/backend/cpp/llama/grpc-server
|
|
||||||
/backend/cpp/llama/llama.cpp
|
|
||||||
|
|
||||||
go-ggml-transformers
|
go-ggml-transformers
|
||||||
go-gpt2
|
go-gpt2
|
||||||
|
|||||||
157
Dockerfile
157
Dockerfile
@@ -1,27 +1,22 @@
|
|||||||
ARG GO_VERSION=1.21-bullseye
|
ARG GO_VERSION=1.21-bullseye
|
||||||
ARG IMAGE_TYPE=extras
|
|
||||||
# extras or core
|
|
||||||
|
|
||||||
|
FROM golang:$GO_VERSION as requirements
|
||||||
FROM golang:$GO_VERSION as requirements-core
|
|
||||||
|
|
||||||
ARG BUILD_TYPE
|
ARG BUILD_TYPE
|
||||||
ARG CUDA_MAJOR_VERSION=11
|
ARG CUDA_MAJOR_VERSION=11
|
||||||
ARG CUDA_MINOR_VERSION=7
|
ARG CUDA_MINOR_VERSION=7
|
||||||
|
ARG SPDLOG_VERSION="1.11.0"
|
||||||
|
ARG PIPER_PHONEMIZE_VERSION='1.0.0'
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG TARGETVARIANT
|
ARG TARGETVARIANT
|
||||||
|
|
||||||
ENV BUILD_TYPE=${BUILD_TYPE}
|
ENV BUILD_TYPE=${BUILD_TYPE}
|
||||||
ENV EXTERNAL_GRPC_BACKENDS="huggingface-embeddings:/build/extra/grpc/huggingface/run.sh,autogptq:/build/extra/grpc/autogptq/run.sh,bark:/build/extra/grpc/bark/run.sh,diffusers:/build/extra/grpc/diffusers/run.sh,exllama:/build/extra/grpc/exllama/run.sh,vall-e-x:/build/extra/grpc/vall-e-x/run.sh,vllm:/build/extra/grpc/vllm/run.sh"
|
ENV EXTERNAL_GRPC_BACKENDS="huggingface-embeddings:/build/extra/grpc/huggingface/huggingface.py,autogptq:/build/extra/grpc/autogptq/autogptq.py,bark:/build/extra/grpc/bark/ttsbark.py,diffusers:/build/extra/grpc/diffusers/backend_diffusers.py,exllama:/build/extra/grpc/exllama/exllama.py,vall-e-x:/build/extra/grpc/vall-e-x/ttsvalle.py,vllm:/build/extra/grpc/vllm/backend_vllm.py"
|
||||||
ENV GALLERIES='[{"name":"model-gallery", "url":"github:go-skynet/model-gallery/index.yaml"}, {"url": "github:go-skynet/model-gallery/huggingface.yaml","name":"huggingface"}]'
|
ENV GALLERIES='[{"name":"model-gallery", "url":"github:go-skynet/model-gallery/index.yaml"}, {"url": "github:go-skynet/model-gallery/huggingface.yaml","name":"huggingface"}]'
|
||||||
ARG GO_TAGS="stablediffusion tts"
|
ARG GO_TAGS="stablediffusion tts"
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y ca-certificates curl patch pip cmake && apt-get clean
|
apt-get install -y ca-certificates cmake curl patch pip
|
||||||
|
|
||||||
|
|
||||||
COPY --chmod=644 custom-ca-certs/* /usr/local/share/ca-certificates/
|
|
||||||
RUN update-ca-certificates
|
|
||||||
|
|
||||||
# Use the variables in subsequent instructions
|
# Use the variables in subsequent instructions
|
||||||
RUN echo "Target Architecture: $TARGETARCH"
|
RUN echo "Target Architecture: $TARGETARCH"
|
||||||
@@ -35,62 +30,66 @@ RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
|
|||||||
dpkg -i cuda-keyring_1.0-1_all.deb && \
|
dpkg -i cuda-keyring_1.0-1_all.deb && \
|
||||||
rm -f cuda-keyring_1.0-1_all.deb && \
|
rm -f cuda-keyring_1.0-1_all.deb && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y cuda-nvcc-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcublas-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcusparse-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcusolver-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} && apt-get clean \
|
apt-get install -y cuda-nvcc-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcublas-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcusparse-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcusolver-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
|
||||||
; fi
|
; fi
|
||||||
ENV PATH /usr/local/cuda/bin:${PATH}
|
ENV PATH /usr/local/cuda/bin:${PATH}
|
||||||
|
|
||||||
# OpenBLAS requirements and stable diffusion
|
|
||||||
RUN apt-get install -y \
|
|
||||||
libopenblas-dev \
|
|
||||||
libopencv-dev \
|
|
||||||
&& apt-get clean
|
|
||||||
|
|
||||||
# Set up OpenCV
|
|
||||||
RUN ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
|
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
RUN test -n "$TARGETARCH" \
|
|
||||||
|| (echo 'warn: missing $TARGETARCH, either set this `ARG` manually, or run using `docker buildkit`')
|
|
||||||
|
|
||||||
# Extras requirements
|
# Extras requirements
|
||||||
FROM requirements-core as requirements-extras
|
|
||||||
|
|
||||||
RUN curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg && \
|
|
||||||
install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg && \
|
|
||||||
gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806 && \
|
|
||||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list && \
|
|
||||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" | tee -a /etc/apt/sources.list.d/conda.list && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y conda
|
|
||||||
|
|
||||||
COPY extra/requirements.txt /build/extra/requirements.txt
|
COPY extra/requirements.txt /build/extra/requirements.txt
|
||||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||||
RUN pip install --upgrade pip
|
RUN pip install --upgrade pip
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
#RUN if [ "${TARGETARCH}" = "amd64" ]; then \
|
RUN if [ "${TARGETARCH}" = "amd64" ]; then \
|
||||||
# pip install git+https://github.com/suno-ai/bark.git diffusers invisible_watermark transformers accelerate safetensors;\
|
pip install git+https://github.com/suno-ai/bark.git diffusers invisible_watermark transformers accelerate safetensors;\
|
||||||
# fi
|
fi
|
||||||
#RUN if [ "${BUILD_TYPE}" = "cublas" ] && [ "${TARGETARCH}" = "amd64" ]; then \
|
RUN if [ "${BUILD_TYPE}" = "cublas" ] && [ "${TARGETARCH}" = "amd64" ]; then \
|
||||||
# pip install torch vllm && pip install auto-gptq https://github.com/jllllll/exllama/releases/download/0.0.10/exllama-0.0.10+cu${CUDA_MAJOR_VERSION}${CUDA_MINOR_VERSION}-cp39-cp39-linux_x86_64.whl;\
|
pip install torch vllm && pip install auto-gptq https://github.com/jllllll/exllama/releases/download/0.0.10/exllama-0.0.10+cu${CUDA_MAJOR_VERSION}${CUDA_MINOR_VERSION}-cp39-cp39-linux_x86_64.whl;\
|
||||||
# fi
|
fi
|
||||||
#RUN pip install -r /build/extra/requirements.txt && rm -rf /build/extra/requirements.txt
|
RUN pip install -r /build/extra/requirements.txt && rm -rf /build/extra/requirements.txt
|
||||||
|
|
||||||
# Vall-e-X
|
# Vall-e-X
|
||||||
RUN git clone https://github.com/Plachtaa/VALL-E-X.git /usr/lib/vall-e-x && cd /usr/lib/vall-e-x && pip install -r requirements.txt
|
RUN git clone https://github.com/Plachtaa/VALL-E-X.git /usr/lib/vall-e-x && cd /usr/lib/vall-e-x && pip install -r requirements.txt
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# OpenBLAS requirements
|
||||||
|
RUN apt-get install -y libopenblas-dev
|
||||||
|
|
||||||
|
# Stable Diffusion requirements
|
||||||
|
RUN apt-get install -y libopencv-dev && \
|
||||||
|
ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
|
||||||
|
|
||||||
|
|
||||||
|
# piper requirements
|
||||||
|
# Use pre-compiled Piper phonemization library (includes onnxruntime)
|
||||||
|
#RUN if echo "${GO_TAGS}" | grep -q "tts"; then \
|
||||||
|
RUN test -n "$TARGETARCH" \
|
||||||
|
|| (echo 'warn: missing $TARGETARCH, either set this `ARG` manually, or run using `docker buildkit`')
|
||||||
|
|
||||||
|
RUN curl -L "https://github.com/gabime/spdlog/archive/refs/tags/v${SPDLOG_VERSION}.tar.gz" | \
|
||||||
|
tar -xzvf - && \
|
||||||
|
mkdir -p "spdlog-${SPDLOG_VERSION}/build" && \
|
||||||
|
cd "spdlog-${SPDLOG_VERSION}/build" && \
|
||||||
|
cmake .. && \
|
||||||
|
make -j8 && \
|
||||||
|
cmake --install . --prefix /usr && mkdir -p "lib/Linux-$(uname -m)" && \
|
||||||
|
cd /build && \
|
||||||
|
mkdir -p "lib/Linux-$(uname -m)/piper_phonemize" && \
|
||||||
|
curl -L "https://github.com/rhasspy/piper-phonemize/releases/download/v${PIPER_PHONEMIZE_VERSION}/libpiper_phonemize-${TARGETARCH:-$(go env GOARCH)}${TARGETVARIANT}.tar.gz" | \
|
||||||
|
tar -C "lib/Linux-$(uname -m)/piper_phonemize" -xzvf - && ls -liah /build/lib/Linux-$(uname -m)/piper_phonemize/ && \
|
||||||
|
cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /usr/lib/ && \
|
||||||
|
ln -s /usr/lib/libpiper_phonemize.so /usr/lib/libpiper_phonemize.so.1 && \
|
||||||
|
cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/include/. /usr/include/
|
||||||
# \
|
# \
|
||||||
# ; fi
|
# ; fi
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
FROM requirements-${IMAGE_TYPE} as builder
|
FROM requirements as builder
|
||||||
|
|
||||||
ARG GO_TAGS="stablediffusion tts"
|
ARG GO_TAGS="stablediffusion tts"
|
||||||
ARG GRPC_BACKENDS
|
|
||||||
ARG BUILD_GRPC=true
|
|
||||||
ENV GRPC_BACKENDS=${GRPC_BACKENDS}
|
|
||||||
ENV GO_TAGS=${GO_TAGS}
|
ENV GO_TAGS=${GO_TAGS}
|
||||||
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||||||
ENV NVIDIA_REQUIRE_CUDA="cuda>=${CUDA_MAJOR_VERSION}.0"
|
ENV NVIDIA_REQUIRE_CUDA="cuda>=${CUDA_MAJOR_VERSION}.0"
|
||||||
@@ -105,43 +104,21 @@ RUN make prepare
|
|||||||
COPY . .
|
COPY . .
|
||||||
COPY .git .
|
COPY .git .
|
||||||
|
|
||||||
# stablediffusion does not tolerate a newer version of abseil, build it first
|
RUN ESPEAK_DATA=/build/lib/Linux-$(uname -m)/piper_phonemize/lib/espeak-ng-data make build
|
||||||
RUN GRPC_BACKENDS=backend-assets/grpc/stablediffusion make build
|
|
||||||
|
|
||||||
RUN if [ "${BUILD_GRPC}" = "true" ]; then \
|
|
||||||
git clone --recurse-submodules -b v1.58.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
|
|
||||||
cd grpc && mkdir -p cmake/build && cd cmake/build && cmake -DgRPC_INSTALL=ON \
|
|
||||||
-DgRPC_BUILD_TESTS=OFF \
|
|
||||||
../.. && make -j12 install && rm -rf grpc \
|
|
||||||
; fi
|
|
||||||
|
|
||||||
# Rebuild with defaults backends
|
|
||||||
RUN make build
|
|
||||||
|
|
||||||
RUN if [ ! -d "/build/go-piper/piper/build/pi/lib/" ]; then \
|
|
||||||
mkdir -p /build/go-piper/piper/build/pi/lib/ \
|
|
||||||
touch /build/go-piper/piper/build/pi/lib/keep \
|
|
||||||
; fi
|
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
FROM requirements-${IMAGE_TYPE}
|
FROM requirements
|
||||||
|
|
||||||
ARG FFMPEG
|
ARG FFMPEG
|
||||||
ARG BUILD_TYPE
|
ARG BUILD_TYPE
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG IMAGE_TYPE=extras
|
|
||||||
|
|
||||||
ENV BUILD_TYPE=${BUILD_TYPE}
|
ENV BUILD_TYPE=${BUILD_TYPE}
|
||||||
ENV REBUILD=false
|
ENV REBUILD=false
|
||||||
ENV HEALTHCHECK_ENDPOINT=http://localhost:8080/readyz
|
ENV HEALTHCHECK_ENDPOINT=http://localhost:8080/readyz
|
||||||
|
|
||||||
ARG CUDA_MAJOR_VERSION=11
|
|
||||||
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
|
||||||
ENV NVIDIA_REQUIRE_CUDA="cuda>=${CUDA_MAJOR_VERSION}.0"
|
|
||||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
|
||||||
|
|
||||||
# Add FFmpeg
|
# Add FFmpeg
|
||||||
RUN if [ "${FFMPEG}" = "true" ]; then \
|
RUN if [ "${FFMPEG}" = "true" ]; then \
|
||||||
apt-get install -y ffmpeg \
|
apt-get install -y ffmpeg \
|
||||||
@@ -155,49 +132,15 @@ WORKDIR /build
|
|||||||
# https://github.com/go-skynet/LocalAI/pull/434
|
# https://github.com/go-skynet/LocalAI/pull/434
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN make prepare-sources
|
RUN make prepare-sources
|
||||||
|
|
||||||
# Copy the binary
|
|
||||||
COPY --from=builder /build/local-ai ./
|
COPY --from=builder /build/local-ai ./
|
||||||
|
|
||||||
# Copy shared libraries for piper
|
|
||||||
COPY --from=builder /build/go-piper/piper/build/pi/lib/* /usr/lib/
|
|
||||||
|
|
||||||
# do not let stablediffusion rebuild (requires an older version of absl)
|
|
||||||
COPY --from=builder /build/backend-assets/grpc/stablediffusion ./backend-assets/grpc/stablediffusion
|
|
||||||
|
|
||||||
## Duplicated from Makefile to avoid having a big layer that's hard to push
|
|
||||||
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/autogptq \
|
|
||||||
; fi
|
|
||||||
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/bark \
|
|
||||||
; fi
|
|
||||||
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/diffusers \
|
|
||||||
; fi
|
|
||||||
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/vllm \
|
|
||||||
; fi
|
|
||||||
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/huggingface \
|
|
||||||
; fi
|
|
||||||
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/vall-e-x \
|
|
||||||
; fi
|
|
||||||
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
|
|
||||||
PATH=$PATH:/opt/conda/bin make -C extra/grpc/exllama \
|
|
||||||
; fi
|
|
||||||
|
|
||||||
# Copy VALLE-X as it's not a real "lib"
|
# Copy VALLE-X as it's not a real "lib"
|
||||||
RUN if [ -d /usr/lib/vall-e-x ]; then \
|
RUN cp -rfv /usr/lib/vall-e-x/* ./
|
||||||
cp -rfv /usr/lib/vall-e-x/* ./ ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# we also copy exllama libs over to resolve exllama import error
|
# To resolve exllama import error
|
||||||
RUN if [ -d /usr/local/lib/python3.9/dist-packages/exllama ]; then \
|
RUN if [ "${BUILD_TYPE}" = "cublas" ] && [ "${TARGETARCH:-$(go env GOARCH)}" = "amd64" ]; then \
|
||||||
cp -rfv /usr/local/lib/python3.9/dist-packages/exllama extra/grpc/exllama/;\
|
cp -rfv /usr/local/lib/python3.9/dist-packages/exllama extra/grpc/exllama/;\
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Define the health check command
|
# Define the health check command
|
||||||
HEALTHCHECK --interval=1m --timeout=10m --retries=10 \
|
HEALTHCHECK --interval=1m --timeout=10m --retries=10 \
|
||||||
CMD curl -f $HEALTHCHECK_ENDPOINT || exit 1
|
CMD curl -f $HEALTHCHECK_ENDPOINT || exit 1
|
||||||
|
|||||||
166
Makefile
166
Makefile
@@ -4,12 +4,10 @@ GOVET=$(GOCMD) vet
|
|||||||
BINARY_NAME=local-ai
|
BINARY_NAME=local-ai
|
||||||
|
|
||||||
# llama.cpp versions
|
# llama.cpp versions
|
||||||
GOLLAMA_VERSION?=aeba71ee842819da681ea537e78846dc75949ac0
|
GOLLAMA_VERSION?=1676dcd7a139b6cdfbaea5fd67f46dc25d9d8bcf
|
||||||
|
|
||||||
GOLLAMA_STABLE_VERSION?=50cee7712066d9e38306eccadcfbb44ea87df4b7
|
GOLLAMA_STABLE_VERSION?=50cee7712066d9e38306eccadcfbb44ea87df4b7
|
||||||
|
|
||||||
CPPLLAMA_VERSION?=a75fa576abba9d37f463580c379e4bbf1e1ad03c
|
|
||||||
|
|
||||||
# gpt4all version
|
# gpt4all version
|
||||||
GPT4ALL_REPO?=https://github.com/nomic-ai/gpt4all
|
GPT4ALL_REPO?=https://github.com/nomic-ai/gpt4all
|
||||||
GPT4ALL_VERSION?=27a8b020c36b0df8f8b82a252d261cda47cf44b8
|
GPT4ALL_VERSION?=27a8b020c36b0df8f8b82a252d261cda47cf44b8
|
||||||
@@ -28,11 +26,17 @@ WHISPER_CPP_VERSION?=85ed71aaec8e0612a84c0b67804bde75aa75a273
|
|||||||
BERT_VERSION?=6abe312cded14042f6b7c3cd8edf082713334a4d
|
BERT_VERSION?=6abe312cded14042f6b7c3cd8edf082713334a4d
|
||||||
|
|
||||||
# go-piper version
|
# go-piper version
|
||||||
PIPER_VERSION?=736f6fb639ab8e3397356e48eeb6bdcb9da88a78
|
PIPER_VERSION?=56b8a81b4760a6fbee1a82e62f007ae7e8f010a7
|
||||||
|
|
||||||
|
# go-bloomz version
|
||||||
|
BLOOMZ_VERSION?=1834e77b83faafe912ad4092ccf7f77937349e2f
|
||||||
|
|
||||||
# stablediffusion version
|
# stablediffusion version
|
||||||
STABLEDIFFUSION_VERSION?=d89260f598afb809279bc72aa0107b4292587632
|
STABLEDIFFUSION_VERSION?=d89260f598afb809279bc72aa0107b4292587632
|
||||||
|
|
||||||
|
# Go-ggllm
|
||||||
|
GOGGLLM_VERSION?=862477d16eefb0805261c19c9b0d053e3b2b684b
|
||||||
|
|
||||||
export BUILD_TYPE?=
|
export BUILD_TYPE?=
|
||||||
export STABLE_BUILD_TYPE?=$(BUILD_TYPE)
|
export STABLE_BUILD_TYPE?=$(BUILD_TYPE)
|
||||||
export CMAKE_ARGS?=
|
export CMAKE_ARGS?=
|
||||||
@@ -41,10 +45,6 @@ CUDA_LIBPATH?=/usr/local/cuda/lib64/
|
|||||||
GO_TAGS?=
|
GO_TAGS?=
|
||||||
BUILD_ID?=git
|
BUILD_ID?=git
|
||||||
|
|
||||||
TEST_DIR=/tmp/test
|
|
||||||
|
|
||||||
RANDOM := $(shell bash -c 'echo $$RANDOM')
|
|
||||||
|
|
||||||
VERSION?=$(shell git describe --always --tags || echo "dev" )
|
VERSION?=$(shell git describe --always --tags || echo "dev" )
|
||||||
# go tool nm ./local-ai | grep Commit
|
# go tool nm ./local-ai | grep Commit
|
||||||
LD_FLAGS?=
|
LD_FLAGS?=
|
||||||
@@ -52,6 +52,7 @@ override LD_FLAGS += -X "github.com/go-skynet/LocalAI/internal.Version=$(VERSION
|
|||||||
override LD_FLAGS += -X "github.com/go-skynet/LocalAI/internal.Commit=$(shell git rev-parse HEAD)"
|
override LD_FLAGS += -X "github.com/go-skynet/LocalAI/internal.Commit=$(shell git rev-parse HEAD)"
|
||||||
|
|
||||||
OPTIONAL_TARGETS?=
|
OPTIONAL_TARGETS?=
|
||||||
|
ESPEAK_DATA?=
|
||||||
|
|
||||||
OS := $(shell uname -s)
|
OS := $(shell uname -s)
|
||||||
ARCH := $(shell uname -m)
|
ARCH := $(shell uname -m)
|
||||||
@@ -61,9 +62,6 @@ WHITE := $(shell tput -Txterm setaf 7)
|
|||||||
CYAN := $(shell tput -Txterm setaf 6)
|
CYAN := $(shell tput -Txterm setaf 6)
|
||||||
RESET := $(shell tput -Txterm sgr0)
|
RESET := $(shell tput -Txterm sgr0)
|
||||||
|
|
||||||
# Default Docker bridge IP
|
|
||||||
E2E_BRIDGE_IP?=172.17.0.1
|
|
||||||
|
|
||||||
ifndef UNAME_S
|
ifndef UNAME_S
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
endif
|
endif
|
||||||
@@ -119,18 +117,10 @@ endif
|
|||||||
ifeq ($(findstring tts,$(GO_TAGS)),tts)
|
ifeq ($(findstring tts,$(GO_TAGS)),tts)
|
||||||
# OPTIONAL_TARGETS+=go-piper/libpiper_binding.a
|
# OPTIONAL_TARGETS+=go-piper/libpiper_binding.a
|
||||||
# OPTIONAL_TARGETS+=backend-assets/espeak-ng-data
|
# OPTIONAL_TARGETS+=backend-assets/espeak-ng-data
|
||||||
PIPER_CGO_CXXFLAGS+=-I$(shell pwd)/go-piper/piper/src/cpp -I$(shell pwd)/go-piper/piper/build/fi/include -I$(shell pwd)/go-piper/piper/build/pi/include -I$(shell pwd)/go-piper/piper/build/si/include
|
|
||||||
PIPER_CGO_LDFLAGS+=-L$(shell pwd)/go-piper/piper/build/fi/lib -L$(shell pwd)/go-piper/piper/build/pi/lib -L$(shell pwd)/go-piper/piper/build/si/lib -lfmt -lspdlog
|
|
||||||
OPTIONAL_GRPC+=backend-assets/grpc/piper
|
OPTIONAL_GRPC+=backend-assets/grpc/piper
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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-stable 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)
|
GRPC_BACKENDS?=backend-assets/grpc/langchain-huggingface backend-assets/grpc/falcon-ggml backend-assets/grpc/bert-embeddings backend-assets/grpc/falcon backend-assets/grpc/bloomz backend-assets/grpc/llama backend-assets/grpc/llama-stable 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)
|
||||||
GRPC_BACKENDS?=$(ALL_GRPC_BACKENDS) $(OPTIONAL_GRPC)
|
|
||||||
|
|
||||||
# If empty, then we build all
|
|
||||||
ifeq ($(GRPC_BACKENDS),)
|
|
||||||
GRPC_BACKENDS=$(ALL_GRPC_BACKENDS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: all test build vendor
|
.PHONY: all test build vendor
|
||||||
|
|
||||||
@@ -141,6 +131,14 @@ gpt4all:
|
|||||||
git clone --recurse-submodules $(GPT4ALL_REPO) gpt4all
|
git clone --recurse-submodules $(GPT4ALL_REPO) gpt4all
|
||||||
cd gpt4all && git checkout -b build $(GPT4ALL_VERSION) && git submodule update --init --recursive --depth 1
|
cd gpt4all && git checkout -b build $(GPT4ALL_VERSION) && git submodule update --init --recursive --depth 1
|
||||||
|
|
||||||
|
## go-ggllm
|
||||||
|
go-ggllm:
|
||||||
|
git clone --recurse-submodules https://github.com/mudler/go-ggllm.cpp go-ggllm
|
||||||
|
cd go-ggllm && git checkout -b build $(GOGGLLM_VERSION) && git submodule update --init --recursive --depth 1
|
||||||
|
|
||||||
|
go-ggllm/libggllm.a: go-ggllm
|
||||||
|
$(MAKE) -C go-ggllm BUILD_TYPE=$(BUILD_TYPE) libggllm.a
|
||||||
|
|
||||||
## go-piper
|
## go-piper
|
||||||
go-piper:
|
go-piper:
|
||||||
git clone --recurse-submodules https://github.com/mudler/go-piper go-piper
|
git clone --recurse-submodules https://github.com/mudler/go-piper go-piper
|
||||||
@@ -167,6 +165,14 @@ go-rwkv:
|
|||||||
go-rwkv/librwkv.a: go-rwkv
|
go-rwkv/librwkv.a: go-rwkv
|
||||||
cd go-rwkv && cd rwkv.cpp && cmake . -DRWKV_BUILD_SHARED_LIBRARY=OFF && cmake --build . && cp librwkv.a ..
|
cd go-rwkv && cd rwkv.cpp && cmake . -DRWKV_BUILD_SHARED_LIBRARY=OFF && cmake --build . && cp librwkv.a ..
|
||||||
|
|
||||||
|
## bloomz
|
||||||
|
bloomz:
|
||||||
|
git clone --recurse-submodules https://github.com/go-skynet/bloomz.cpp bloomz
|
||||||
|
cd bloomz && git checkout -b build $(BLOOMZ_VERSION) && git submodule update --init --recursive --depth 1
|
||||||
|
|
||||||
|
bloomz/libbloomz.a: bloomz
|
||||||
|
cd bloomz && make libbloomz.a
|
||||||
|
|
||||||
go-bert/libgobert.a: go-bert
|
go-bert/libgobert.a: go-bert
|
||||||
$(MAKE) -C go-bert libgobert.a
|
$(MAKE) -C go-bert libgobert.a
|
||||||
|
|
||||||
@@ -176,10 +182,14 @@ backend-assets/gpt4all: gpt4all/gpt4all-bindings/golang/libgpt4all.a
|
|||||||
@cp gpt4all/gpt4all-bindings/golang/buildllm/*.dylib backend-assets/gpt4all/ || true
|
@cp gpt4all/gpt4all-bindings/golang/buildllm/*.dylib backend-assets/gpt4all/ || true
|
||||||
@cp gpt4all/gpt4all-bindings/golang/buildllm/*.dll backend-assets/gpt4all/ || true
|
@cp gpt4all/gpt4all-bindings/golang/buildllm/*.dll backend-assets/gpt4all/ || true
|
||||||
|
|
||||||
backend-assets/espeak-ng-data: go-piper
|
backend-assets/espeak-ng-data:
|
||||||
mkdir -p backend-assets/espeak-ng-data
|
mkdir -p backend-assets/espeak-ng-data
|
||||||
$(MAKE) -C go-piper piper.o
|
ifdef ESPEAK_DATA
|
||||||
@cp -rf go-piper/piper/build/pi/share/espeak-ng-data/. backend-assets/espeak-ng-data
|
@cp -rf $(ESPEAK_DATA)/. backend-assets/espeak-ng-data
|
||||||
|
else
|
||||||
|
@echo "ESPEAK_DATA not set, skipping tts. Note that this will break the tts functionality."
|
||||||
|
@touch backend-assets/espeak-ng-data/keep
|
||||||
|
endif
|
||||||
|
|
||||||
gpt4all/gpt4all-bindings/golang/libgpt4all.a: gpt4all
|
gpt4all/gpt4all-bindings/golang/libgpt4all.a: gpt4all
|
||||||
$(MAKE) -C gpt4all/gpt4all-bindings/golang/ libgpt4all.a
|
$(MAKE) -C gpt4all/gpt4all-bindings/golang/ libgpt4all.a
|
||||||
@@ -213,10 +223,10 @@ go-llama/libbinding.a: go-llama
|
|||||||
go-llama-stable/libbinding.a: go-llama-stable
|
go-llama-stable/libbinding.a: go-llama-stable
|
||||||
$(MAKE) -C go-llama-stable BUILD_TYPE=$(STABLE_BUILD_TYPE) libbinding.a
|
$(MAKE) -C go-llama-stable BUILD_TYPE=$(STABLE_BUILD_TYPE) libbinding.a
|
||||||
|
|
||||||
go-piper/libpiper_binding.a: go-piper
|
go-piper/libpiper_binding.a:
|
||||||
$(MAKE) -C go-piper libpiper_binding.a example/main
|
$(MAKE) -C go-piper libpiper_binding.a example/main
|
||||||
|
|
||||||
get-sources: go-llama go-llama-stable go-ggml-transformers gpt4all go-piper go-rwkv whisper.cpp go-bert go-stable-diffusion
|
get-sources: go-llama go-llama-stable go-ggllm go-ggml-transformers gpt4all go-piper go-rwkv whisper.cpp go-bert bloomz go-stable-diffusion
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
replace:
|
replace:
|
||||||
@@ -225,8 +235,10 @@ replace:
|
|||||||
$(GOCMD) mod edit -replace github.com/donomii/go-rwkv.cpp=$(shell pwd)/go-rwkv
|
$(GOCMD) mod edit -replace github.com/donomii/go-rwkv.cpp=$(shell pwd)/go-rwkv
|
||||||
$(GOCMD) mod edit -replace github.com/ggerganov/whisper.cpp=$(shell pwd)/whisper.cpp
|
$(GOCMD) mod edit -replace github.com/ggerganov/whisper.cpp=$(shell pwd)/whisper.cpp
|
||||||
$(GOCMD) mod edit -replace github.com/go-skynet/go-bert.cpp=$(shell pwd)/go-bert
|
$(GOCMD) mod edit -replace github.com/go-skynet/go-bert.cpp=$(shell pwd)/go-bert
|
||||||
|
$(GOCMD) mod edit -replace github.com/go-skynet/bloomz.cpp=$(shell pwd)/bloomz
|
||||||
$(GOCMD) mod edit -replace github.com/mudler/go-stable-diffusion=$(shell pwd)/go-stable-diffusion
|
$(GOCMD) mod edit -replace github.com/mudler/go-stable-diffusion=$(shell pwd)/go-stable-diffusion
|
||||||
$(GOCMD) mod edit -replace github.com/mudler/go-piper=$(shell pwd)/go-piper
|
$(GOCMD) mod edit -replace github.com/mudler/go-piper=$(shell pwd)/go-piper
|
||||||
|
$(GOCMD) mod edit -replace github.com/mudler/go-ggllm.cpp=$(shell pwd)/go-ggllm
|
||||||
|
|
||||||
prepare-sources: get-sources replace
|
prepare-sources: get-sources replace
|
||||||
$(GOCMD) mod download
|
$(GOCMD) mod download
|
||||||
@@ -242,7 +254,9 @@ rebuild: ## Rebuilds the project
|
|||||||
$(MAKE) -C whisper.cpp clean
|
$(MAKE) -C whisper.cpp clean
|
||||||
$(MAKE) -C go-stable-diffusion clean
|
$(MAKE) -C go-stable-diffusion clean
|
||||||
$(MAKE) -C go-bert clean
|
$(MAKE) -C go-bert clean
|
||||||
|
$(MAKE) -C bloomz clean
|
||||||
$(MAKE) -C go-piper clean
|
$(MAKE) -C go-piper clean
|
||||||
|
$(MAKE) -C go-ggllm clean
|
||||||
$(MAKE) build
|
$(MAKE) build
|
||||||
|
|
||||||
prepare: prepare-sources $(OPTIONAL_TARGETS)
|
prepare: prepare-sources $(OPTIONAL_TARGETS)
|
||||||
@@ -260,14 +274,12 @@ clean: ## Remove build related file
|
|||||||
rm -rf ./backend-assets
|
rm -rf ./backend-assets
|
||||||
rm -rf ./go-rwkv
|
rm -rf ./go-rwkv
|
||||||
rm -rf ./go-bert
|
rm -rf ./go-bert
|
||||||
|
rm -rf ./bloomz
|
||||||
rm -rf ./whisper.cpp
|
rm -rf ./whisper.cpp
|
||||||
rm -rf ./go-piper
|
rm -rf ./go-piper
|
||||||
|
rm -rf ./go-ggllm
|
||||||
rm -rf $(BINARY_NAME)
|
rm -rf $(BINARY_NAME)
|
||||||
rm -rf release/
|
rm -rf release/
|
||||||
rm -rf ./backend/cpp/grpc/grpc_repo
|
|
||||||
rm -rf ./backend/cpp/grpc/build
|
|
||||||
rm -rf ./backend/cpp/grpc/installed_packages
|
|
||||||
$(MAKE) -C backend/cpp/llama clean
|
|
||||||
|
|
||||||
## Build:
|
## Build:
|
||||||
|
|
||||||
@@ -290,12 +302,12 @@ run: prepare ## run local-ai
|
|||||||
test-models/testmodel:
|
test-models/testmodel:
|
||||||
mkdir test-models
|
mkdir test-models
|
||||||
mkdir test-dir
|
mkdir test-dir
|
||||||
wget -q https://huggingface.co/nnakasato/ggml-model-test/resolve/main/ggml-model-q4.bin -O test-models/testmodel
|
wget 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 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 https://huggingface.co/skeskinen/ggml/resolve/main/all-MiniLM-L6-v2/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 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 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
|
wget https://raw.githubusercontent.com/saharNooby/rwkv.cpp/5eb8f09c146ea8124633ab041d9ea0b1f1db4459/rwkv/20B_tokenizer.json -O test-models/rwkv.tokenizer.json
|
||||||
cp tests/models_fixtures/* test-models
|
cp tests/models_fixtures/* test-models
|
||||||
|
|
||||||
prepare-test: grpcs
|
prepare-test: grpcs
|
||||||
@@ -306,34 +318,14 @@ test: prepare test-models/testmodel grpcs
|
|||||||
@echo 'Running tests'
|
@echo 'Running tests'
|
||||||
export GO_TAGS="tts stablediffusion"
|
export GO_TAGS="tts stablediffusion"
|
||||||
$(MAKE) prepare-test
|
$(MAKE) prepare-test
|
||||||
HUGGINGFACE_GRPC=$(abspath ./)/extra/grpc/huggingface/run.sh TEST_DIR=$(abspath ./)/test-dir/ FIXTURES=$(abspath ./)/tests/fixtures CONFIG_FILE=$(abspath ./)/test-models/config.yaml MODELS_PATH=$(abspath ./)/test-models \
|
HUGGINGFACE_GRPC=$(abspath ./)/extra/grpc/huggingface/huggingface.py 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 && !llama && !llama-gguf" --flake-attempts 5 --fail-fast -v -r ./api ./pkg
|
$(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter="!gpt4all && !llama && !llama-gguf" --flake-attempts 5 -v -r ./api ./pkg
|
||||||
$(MAKE) test-gpt4all
|
$(MAKE) test-gpt4all
|
||||||
$(MAKE) test-llama
|
$(MAKE) test-llama
|
||||||
$(MAKE) test-llama-gguf
|
$(MAKE) test-llama-gguf
|
||||||
$(MAKE) test-tts
|
$(MAKE) test-tts
|
||||||
$(MAKE) test-stablediffusion
|
$(MAKE) test-stablediffusion
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
test-gpt4all: prepare-test
|
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 \
|
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
|
$(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter="gpt4all" --flake-attempts 5 -v -r ./api ./pkg
|
||||||
@@ -386,20 +378,14 @@ protogen-python:
|
|||||||
python3 -m grpc_tools.protoc -Ipkg/grpc/proto/ --python_out=extra/grpc/vllm/ --grpc_python_out=extra/grpc/vllm/ pkg/grpc/proto/backend.proto
|
python3 -m grpc_tools.protoc -Ipkg/grpc/proto/ --python_out=extra/grpc/vllm/ --grpc_python_out=extra/grpc/vllm/ pkg/grpc/proto/backend.proto
|
||||||
|
|
||||||
## GRPC
|
## GRPC
|
||||||
# Note: it is duplicated in the Dockerfile
|
|
||||||
prepare-extra-conda-environments:
|
|
||||||
$(MAKE) -C extra/grpc/autogptq
|
|
||||||
$(MAKE) -C extra/grpc/bark
|
|
||||||
$(MAKE) -C extra/grpc/diffusers
|
|
||||||
$(MAKE) -C extra/grpc/vllm
|
|
||||||
$(MAKE) -C extra/grpc/huggingface
|
|
||||||
$(MAKE) -C extra/grpc/vall-e-x
|
|
||||||
$(MAKE) -C extra/grpc/exllama
|
|
||||||
|
|
||||||
|
|
||||||
backend-assets/grpc:
|
backend-assets/grpc:
|
||||||
mkdir -p backend-assets/grpc
|
mkdir -p backend-assets/grpc
|
||||||
|
|
||||||
|
backend-assets/grpc/falcon: backend-assets/grpc go-ggllm/libggllm.a
|
||||||
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-ggllm LIBRARY_PATH=$(shell pwd)/go-ggllm \
|
||||||
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/falcon ./cmd/grpc/falcon/
|
||||||
|
|
||||||
backend-assets/grpc/llama: backend-assets/grpc go-llama/libbinding.a
|
backend-assets/grpc/llama: backend-assets/grpc go-llama/libbinding.a
|
||||||
$(GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp=$(shell pwd)/go-llama
|
$(GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp=$(shell pwd)/go-llama
|
||||||
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-llama LIBRARY_PATH=$(shell pwd)/go-llama \
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-llama LIBRARY_PATH=$(shell pwd)/go-llama \
|
||||||
@@ -409,37 +395,6 @@ ifeq ($(BUILD_TYPE),metal)
|
|||||||
cp go-llama/build/bin/ggml-metal.metal backend-assets/grpc/
|
cp go-llama/build/bin/ggml-metal.metal backend-assets/grpc/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
backend/cpp/llama/grpc-server:
|
|
||||||
ifdef BUILD_GRPC_FOR_BACKEND_LLAMA
|
|
||||||
backend/cpp/grpc/script/build_grpc.sh ${INSTALLED_PACKAGES}
|
|
||||||
export _PROTOBUF_PROTOC=${INSTALLED_PACKAGES}/bin/proto && \
|
|
||||||
export _GRPC_CPP_PLUGIN_EXECUTABLE=${INSTALLED_PACKAGES}/bin/grpc_cpp_plugin && \
|
|
||||||
export PATH=${PATH}:${INSTALLED_PACKAGES}/bin && \
|
|
||||||
CMAKE_ARGS="${ADDED_CMAKE_ARGS}" LLAMA_VERSION=$(CPPLLAMA_VERSION) $(MAKE) -C backend/cpp/llama grpc-server
|
|
||||||
else
|
|
||||||
echo "BUILD_GRPC_FOR_BACKEND_LLAMA is not defined."
|
|
||||||
LLAMA_VERSION=$(CPPLLAMA_VERSION) $(MAKE) -C backend/cpp/llama grpc-server
|
|
||||||
endif
|
|
||||||
## BACKEND CPP LLAMA END
|
|
||||||
|
|
||||||
##
|
|
||||||
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
|
|
||||||
ifeq ($(BUILD_TYPE),metal)
|
|
||||||
cp backend/cpp/llama/llama.cpp/build/bin/ggml-metal.metal backend-assets/grpc/
|
|
||||||
endif
|
|
||||||
|
|
||||||
backend-assets/grpc/llama-stable: backend-assets/grpc go-llama-stable/libbinding.a
|
backend-assets/grpc/llama-stable: backend-assets/grpc go-llama-stable/libbinding.a
|
||||||
$(GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp=$(shell pwd)/go-llama-stable
|
$(GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp=$(shell pwd)/go-llama-stable
|
||||||
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-llama-stable LIBRARY_PATH=$(shell pwd)/go-llama \
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-llama-stable LIBRARY_PATH=$(shell pwd)/go-llama \
|
||||||
@@ -485,6 +440,10 @@ backend-assets/grpc/rwkv: backend-assets/grpc go-rwkv/librwkv.a
|
|||||||
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-rwkv LIBRARY_PATH=$(shell pwd)/go-rwkv \
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-rwkv LIBRARY_PATH=$(shell pwd)/go-rwkv \
|
||||||
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/rwkv ./cmd/grpc/rwkv/
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/rwkv ./cmd/grpc/rwkv/
|
||||||
|
|
||||||
|
backend-assets/grpc/bloomz: backend-assets/grpc bloomz/libbloomz.a
|
||||||
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/bloomz LIBRARY_PATH=$(shell pwd)/bloomz \
|
||||||
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/bloomz ./cmd/grpc/bloomz/
|
||||||
|
|
||||||
backend-assets/grpc/bert-embeddings: backend-assets/grpc go-bert/libgobert.a
|
backend-assets/grpc/bert-embeddings: backend-assets/grpc go-bert/libgobert.a
|
||||||
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-bert LIBRARY_PATH=$(shell pwd)/go-bert \
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-bert LIBRARY_PATH=$(shell pwd)/go-bert \
|
||||||
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/bert-embeddings ./cmd/grpc/bert-embeddings/
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/bert-embeddings ./cmd/grpc/bert-embeddings/
|
||||||
@@ -492,15 +451,12 @@ backend-assets/grpc/bert-embeddings: backend-assets/grpc go-bert/libgobert.a
|
|||||||
backend-assets/grpc/langchain-huggingface: backend-assets/grpc
|
backend-assets/grpc/langchain-huggingface: backend-assets/grpc
|
||||||
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/langchain-huggingface ./cmd/grpc/langchain-huggingface/
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/langchain-huggingface ./cmd/grpc/langchain-huggingface/
|
||||||
|
|
||||||
backend-assets/grpc/stablediffusion: backend-assets/grpc
|
backend-assets/grpc/stablediffusion: backend-assets/grpc go-stable-diffusion/libstablediffusion.a
|
||||||
if [ ! -f backend-assets/grpc/stablediffusion ]; then \
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-stable-diffusion/ LIBRARY_PATH=$(shell pwd)/go-stable-diffusion/ \
|
||||||
$(MAKE) go-stable-diffusion/libstablediffusion.a; \
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/stablediffusion ./cmd/grpc/stablediffusion/
|
||||||
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/go-stable-diffusion/ LIBRARY_PATH=$(shell pwd)/go-stable-diffusion/ \
|
|
||||||
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/stablediffusion ./cmd/grpc/stablediffusion/; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
backend-assets/grpc/piper: backend-assets/grpc backend-assets/espeak-ng-data go-piper/libpiper_binding.a
|
backend-assets/grpc/piper: backend-assets/grpc backend-assets/espeak-ng-data go-piper/libpiper_binding.a
|
||||||
CGO_CXXFLAGS="$(PIPER_CGO_CXXFLAGS)" CGO_LDFLAGS="$(PIPER_CGO_LDFLAGS)" LIBRARY_PATH=$(shell pwd)/go-piper \
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" LIBRARY_PATH=$(shell pwd)/go-piper \
|
||||||
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/piper ./cmd/grpc/piper/
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/piper ./cmd/grpc/piper/
|
||||||
|
|
||||||
backend-assets/grpc/whisper: backend-assets/grpc whisper.cpp/libwhisper.a
|
backend-assets/grpc/whisper: backend-assets/grpc whisper.cpp/libwhisper.a
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/go-skynet/LocalAI/api/options"
|
"github.com/go-skynet/LocalAI/api/options"
|
||||||
"github.com/go-skynet/LocalAI/api/schema"
|
"github.com/go-skynet/LocalAI/api/schema"
|
||||||
"github.com/go-skynet/LocalAI/internal"
|
"github.com/go-skynet/LocalAI/internal"
|
||||||
"github.com/go-skynet/LocalAI/metrics"
|
|
||||||
"github.com/go-skynet/LocalAI/pkg/assets"
|
"github.com/go-skynet/LocalAI/pkg/assets"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
@@ -121,9 +120,6 @@ func App(opts ...options.AppOption) (*fiber.App, error) {
|
|||||||
|
|
||||||
// Default middleware config
|
// Default middleware config
|
||||||
app.Use(recover.New())
|
app.Use(recover.New())
|
||||||
if options.Metrics != nil {
|
|
||||||
app.Use(metrics.APIMiddleware(options.Metrics))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auth middleware checking if API key is valid. If no API key is set, no auth is required.
|
// Auth middleware checking if API key is valid. If no API key is set, no auth is required.
|
||||||
auth := func(c *fiber.Ctx) error {
|
auth := func(c *fiber.Ctx) error {
|
||||||
@@ -233,7 +229,5 @@ func App(opts ...options.AppOption) (*fiber.App, error) {
|
|||||||
app.Get("/v1/models", auth, openai.ListModelsEndpoint(options.Loader, cl))
|
app.Get("/v1/models", auth, openai.ListModelsEndpoint(options.Loader, cl))
|
||||||
app.Get("/models", auth, openai.ListModelsEndpoint(options.Loader, cl))
|
app.Get("/models", auth, openai.ListModelsEndpoint(options.Loader, cl))
|
||||||
|
|
||||||
app.Get("/metrics", metrics.MetricsHandler())
|
|
||||||
|
|
||||||
return app, nil
|
return app, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import (
|
|||||||
|
|
||||||
. "github.com/go-skynet/LocalAI/api"
|
. "github.com/go-skynet/LocalAI/api"
|
||||||
"github.com/go-skynet/LocalAI/api/options"
|
"github.com/go-skynet/LocalAI/api/options"
|
||||||
"github.com/go-skynet/LocalAI/metrics"
|
|
||||||
"github.com/go-skynet/LocalAI/pkg/gallery"
|
"github.com/go-skynet/LocalAI/pkg/gallery"
|
||||||
"github.com/go-skynet/LocalAI/pkg/model"
|
"github.com/go-skynet/LocalAI/pkg/model"
|
||||||
"github.com/go-skynet/LocalAI/pkg/utils"
|
"github.com/go-skynet/LocalAI/pkg/utils"
|
||||||
@@ -163,12 +162,8 @@ var _ = Describe("API test", func() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
metricsService, err := metrics.SetupMetrics()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
app, err = App(
|
app, err = App(
|
||||||
append(commonOpts,
|
append(commonOpts,
|
||||||
options.WithMetrics(metricsService),
|
|
||||||
options.WithContext(c),
|
options.WithContext(c),
|
||||||
options.WithGalleries(galleries),
|
options.WithGalleries(galleries),
|
||||||
options.WithModelLoader(modelLoader), options.WithBackendAssets(backendAssets), options.WithBackendAssetsOutput(tmpdir))...)
|
options.WithModelLoader(modelLoader), options.WithBackendAssets(backendAssets), options.WithBackendAssetsOutput(tmpdir))...)
|
||||||
@@ -457,7 +452,7 @@ var _ = Describe("API test", func() {
|
|||||||
Eventually(func() bool {
|
Eventually(func() bool {
|
||||||
response := getModelStatus("http://127.0.0.1:9090/models/jobs/" + uuid)
|
response := getModelStatus("http://127.0.0.1:9090/models/jobs/" + uuid)
|
||||||
return response["processed"].(bool)
|
return response["processed"].(bool)
|
||||||
}, "960s", "10s").Should(Equal(true))
|
}, "360s", "10s").Should(Equal(true))
|
||||||
|
|
||||||
resp, err := client.CreateChatCompletion(context.TODO(), openai.ChatCompletionRequest{Model: "gpt4all-j", Messages: []openai.ChatCompletionMessage{openai.ChatCompletionMessage{Role: "user", Content: "How are you?"}}})
|
resp, err := client.CreateChatCompletion(context.TODO(), openai.ChatCompletionRequest{Model: "gpt4all-j", Messages: []openai.ChatCompletionMessage{openai.ChatCompletionMessage{Role: "user", Content: "How are you?"}}})
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@@ -484,13 +479,9 @@ var _ = Describe("API test", func() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
metricsService, err := metrics.SetupMetrics()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
app, err = App(
|
app, err = App(
|
||||||
append(commonOpts,
|
append(commonOpts,
|
||||||
options.WithContext(c),
|
options.WithContext(c),
|
||||||
options.WithMetrics(metricsService),
|
|
||||||
options.WithAudioDir(tmpdir),
|
options.WithAudioDir(tmpdir),
|
||||||
options.WithImageDir(tmpdir),
|
options.WithImageDir(tmpdir),
|
||||||
options.WithGalleries(galleries),
|
options.WithGalleries(galleries),
|
||||||
@@ -592,15 +583,12 @@ var _ = Describe("API test", func() {
|
|||||||
modelLoader = model.NewModelLoader(os.Getenv("MODELS_PATH"))
|
modelLoader = model.NewModelLoader(os.Getenv("MODELS_PATH"))
|
||||||
c, cancel = context.WithCancel(context.Background())
|
c, cancel = context.WithCancel(context.Background())
|
||||||
|
|
||||||
metricsService, err := metrics.SetupMetrics()
|
var err error
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
app, err = App(
|
app, err = App(
|
||||||
append(commonOpts,
|
append(commonOpts,
|
||||||
options.WithExternalBackend("huggingface", os.Getenv("HUGGINGFACE_GRPC")),
|
options.WithExternalBackend("huggingface", os.Getenv("HUGGINGFACE_GRPC")),
|
||||||
options.WithContext(c),
|
options.WithContext(c),
|
||||||
options.WithModelLoader(modelLoader),
|
options.WithModelLoader(modelLoader),
|
||||||
options.WithMetrics(metricsService),
|
|
||||||
)...)
|
)...)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
go app.Listen("127.0.0.1:9090")
|
go app.Listen("127.0.0.1:9090")
|
||||||
@@ -687,7 +675,7 @@ var _ = Describe("API test", func() {
|
|||||||
Input: []string{"sun", "cat"},
|
Input: []string{"sun", "cat"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
Expect(err).ToNot(HaveOccurred(), err)
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(resp.Data[0].Embedding)).To(BeNumerically("==", 384))
|
Expect(len(resp.Data[0].Embedding)).To(BeNumerically("==", 384))
|
||||||
Expect(len(resp.Data[1].Embedding)).To(BeNumerically("==", 384))
|
Expect(len(resp.Data[1].Embedding)).To(BeNumerically("==", 384))
|
||||||
|
|
||||||
@@ -804,13 +792,10 @@ var _ = Describe("API test", func() {
|
|||||||
modelLoader = model.NewModelLoader(os.Getenv("MODELS_PATH"))
|
modelLoader = model.NewModelLoader(os.Getenv("MODELS_PATH"))
|
||||||
c, cancel = context.WithCancel(context.Background())
|
c, cancel = context.WithCancel(context.Background())
|
||||||
|
|
||||||
metricsService, err := metrics.SetupMetrics()
|
var err error
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
app, err = App(
|
app, err = App(
|
||||||
append(commonOpts,
|
append(commonOpts,
|
||||||
options.WithContext(c),
|
options.WithContext(c),
|
||||||
options.WithMetrics(metricsService),
|
|
||||||
options.WithModelLoader(modelLoader),
|
options.WithModelLoader(modelLoader),
|
||||||
options.WithConfigFile(os.Getenv("CONFIG_FILE")))...,
|
options.WithConfigFile(os.Getenv("CONFIG_FILE")))...,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ func ImageGeneration(height, width, mode, step, seed int, positive_prompt, negat
|
|||||||
PipelineType: c.Diffusers.PipelineType,
|
PipelineType: c.Diffusers.PipelineType,
|
||||||
CFGScale: c.Diffusers.CFGScale,
|
CFGScale: c.Diffusers.CFGScale,
|
||||||
LoraAdapter: c.LoraAdapter,
|
LoraAdapter: c.LoraAdapter,
|
||||||
LoraScale: c.LoraScale,
|
|
||||||
LoraBase: c.LoraBase,
|
LoraBase: c.LoraBase,
|
||||||
IMG2IMG: c.Diffusers.IMG2IMG,
|
IMG2IMG: c.Diffusers.IMG2IMG,
|
||||||
CLIPModel: c.Diffusers.ClipModel,
|
CLIPModel: c.Diffusers.ClipModel,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type TokenUsage struct {
|
|||||||
Completion int
|
Completion int
|
||||||
}
|
}
|
||||||
|
|
||||||
func ModelInference(ctx context.Context, s string, images []string, loader *model.ModelLoader, c config.Config, o *options.Option, tokenCallback func(string, TokenUsage) bool) (func() (LLMResponse, error), error) {
|
func ModelInference(ctx context.Context, s string, loader *model.ModelLoader, c config.Config, o *options.Option, tokenCallback func(string, TokenUsage) bool) (func() (LLMResponse, error), error) {
|
||||||
modelFile := c.Model
|
modelFile := c.Model
|
||||||
|
|
||||||
grpcOpts := gRPCModelOpts(c)
|
grpcOpts := gRPCModelOpts(c)
|
||||||
@@ -72,7 +72,6 @@ func ModelInference(ctx context.Context, s string, images []string, loader *mode
|
|||||||
fn := func() (LLMResponse, error) {
|
fn := func() (LLMResponse, error) {
|
||||||
opts := gRPCPredictOpts(c, loader.ModelPath)
|
opts := gRPCPredictOpts(c, loader.ModelPath)
|
||||||
opts.Prompt = s
|
opts.Prompt = s
|
||||||
opts.Images = images
|
|
||||||
|
|
||||||
tokenUsage := TokenUsage{}
|
tokenUsage := TokenUsage{}
|
||||||
|
|
||||||
|
|||||||
@@ -38,35 +38,29 @@ func gRPCModelOpts(c config.Config) *pb.ModelOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &pb.ModelOptions{
|
return &pb.ModelOptions{
|
||||||
ContextSize: int32(c.ContextSize),
|
ContextSize: int32(c.ContextSize),
|
||||||
Seed: int32(c.Seed),
|
Seed: int32(c.Seed),
|
||||||
NBatch: int32(b),
|
NBatch: int32(b),
|
||||||
NoMulMatQ: c.NoMulMatQ,
|
NoMulMatQ: c.NoMulMatQ,
|
||||||
DraftModel: c.DraftModel,
|
DraftModel: c.DraftModel,
|
||||||
AudioPath: c.VallE.AudioPath,
|
AudioPath: c.VallE.AudioPath,
|
||||||
Quantization: c.Quantization,
|
Quantization: c.Quantization,
|
||||||
MMProj: c.MMProj,
|
LoraAdapter: c.LoraAdapter,
|
||||||
YarnExtFactor: c.YarnExtFactor,
|
LoraBase: c.LoraBase,
|
||||||
YarnAttnFactor: c.YarnAttnFactor,
|
NGQA: c.NGQA,
|
||||||
YarnBetaFast: c.YarnBetaFast,
|
RMSNormEps: c.RMSNormEps,
|
||||||
YarnBetaSlow: c.YarnBetaSlow,
|
F16Memory: c.F16,
|
||||||
LoraAdapter: c.LoraAdapter,
|
MLock: c.MMlock,
|
||||||
LoraBase: c.LoraBase,
|
RopeFreqBase: c.RopeFreqBase,
|
||||||
LoraScale: c.LoraScale,
|
RopeFreqScale: c.RopeFreqScale,
|
||||||
NGQA: c.NGQA,
|
NUMA: c.NUMA,
|
||||||
RMSNormEps: c.RMSNormEps,
|
Embeddings: c.Embeddings,
|
||||||
F16Memory: c.F16,
|
LowVRAM: c.LowVRAM,
|
||||||
MLock: c.MMlock,
|
NGPULayers: int32(c.NGPULayers),
|
||||||
RopeFreqBase: c.RopeFreqBase,
|
MMap: c.MMap,
|
||||||
RopeFreqScale: c.RopeFreqScale,
|
MainGPU: c.MainGPU,
|
||||||
NUMA: c.NUMA,
|
Threads: int32(c.Threads),
|
||||||
Embeddings: c.Embeddings,
|
TensorSplit: c.TensorSplit,
|
||||||
LowVRAM: c.LowVRAM,
|
|
||||||
NGPULayers: int32(c.NGPULayers),
|
|
||||||
MMap: c.MMap,
|
|
||||||
MainGPU: c.MainGPU,
|
|
||||||
Threads: int32(c.Threads),
|
|
||||||
TensorSplit: c.TensorSplit,
|
|
||||||
// AutoGPTQ
|
// AutoGPTQ
|
||||||
ModelBaseName: c.AutoGPTQ.ModelBaseName,
|
ModelBaseName: c.AutoGPTQ.ModelBaseName,
|
||||||
Device: c.AutoGPTQ.Device,
|
Device: c.AutoGPTQ.Device,
|
||||||
|
|||||||
@@ -100,18 +100,10 @@ type LLMConfig struct {
|
|||||||
NUMA bool `yaml:"numa"`
|
NUMA bool `yaml:"numa"`
|
||||||
LoraAdapter string `yaml:"lora_adapter"`
|
LoraAdapter string `yaml:"lora_adapter"`
|
||||||
LoraBase string `yaml:"lora_base"`
|
LoraBase string `yaml:"lora_base"`
|
||||||
LoraScale float32 `yaml:"lora_scale"`
|
|
||||||
NoMulMatQ bool `yaml:"no_mulmatq"`
|
NoMulMatQ bool `yaml:"no_mulmatq"`
|
||||||
DraftModel string `yaml:"draft_model"`
|
DraftModel string `yaml:"draft_model"`
|
||||||
NDraft int32 `yaml:"n_draft"`
|
NDraft int32 `yaml:"n_draft"`
|
||||||
Quantization string `yaml:"quantization"`
|
Quantization string `yaml:"quantization"`
|
||||||
MMProj string `yaml:"mmproj"`
|
|
||||||
|
|
||||||
RopeScaling string `yaml:"rope_scaling"`
|
|
||||||
YarnExtFactor float32 `yaml:"yarn_ext_factor"`
|
|
||||||
YarnAttnFactor float32 `yaml:"yarn_attn_factor"`
|
|
||||||
YarnBetaFast float32 `yaml:"yarn_beta_fast"`
|
|
||||||
YarnBetaSlow float32 `yaml:"yarn_beta_slow"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AutoGPTQ struct {
|
type AutoGPTQ struct {
|
||||||
|
|||||||
@@ -81,10 +81,6 @@ func ChatEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fiber.Ctx)
|
|||||||
noActionDescription = config.FunctionsConfig.NoActionDescriptionName
|
noActionDescription = config.FunctionsConfig.NoActionDescriptionName
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.ResponseFormat == "json_object" {
|
|
||||||
input.Grammar = grammar.JSONBNF
|
|
||||||
}
|
|
||||||
|
|
||||||
// process functions if we have any defined or if we have a function call string
|
// process functions if we have any defined or if we have a function call string
|
||||||
if len(input.Functions) > 0 && config.ShouldUseFunctions() {
|
if len(input.Functions) > 0 && config.ShouldUseFunctions() {
|
||||||
log.Debug().Msgf("Response needs to process functions")
|
log.Debug().Msgf("Response needs to process functions")
|
||||||
@@ -144,14 +140,14 @@ func ChatEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fiber.Ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
r := config.Roles[role]
|
r := config.Roles[role]
|
||||||
contentExists := i.Content != nil && i.StringContent != ""
|
contentExists := i.Content != nil && *i.Content != ""
|
||||||
// First attempt to populate content via a chat message specific template
|
// First attempt to populate content via a chat message specific template
|
||||||
if config.TemplateConfig.ChatMessage != "" {
|
if config.TemplateConfig.ChatMessage != "" {
|
||||||
chatMessageData := model.ChatMessageTemplateData{
|
chatMessageData := model.ChatMessageTemplateData{
|
||||||
SystemPrompt: config.SystemPrompt,
|
SystemPrompt: config.SystemPrompt,
|
||||||
Role: r,
|
Role: r,
|
||||||
RoleName: role,
|
RoleName: role,
|
||||||
Content: i.StringContent,
|
Content: *i.Content,
|
||||||
MessageIndex: messageIndex,
|
MessageIndex: messageIndex,
|
||||||
}
|
}
|
||||||
templatedChatMessage, err := o.Loader.EvaluateTemplateForChatMessage(config.TemplateConfig.ChatMessage, chatMessageData)
|
templatedChatMessage, err := o.Loader.EvaluateTemplateForChatMessage(config.TemplateConfig.ChatMessage, chatMessageData)
|
||||||
@@ -170,7 +166,7 @@ func ChatEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fiber.Ctx)
|
|||||||
if content == "" {
|
if content == "" {
|
||||||
if r != "" {
|
if r != "" {
|
||||||
if contentExists {
|
if contentExists {
|
||||||
content = fmt.Sprint(r, i.StringContent)
|
content = fmt.Sprint(r, " ", *i.Content)
|
||||||
}
|
}
|
||||||
if i.FunctionCall != nil {
|
if i.FunctionCall != nil {
|
||||||
j, err := json.Marshal(i.FunctionCall)
|
j, err := json.Marshal(i.FunctionCall)
|
||||||
@@ -184,7 +180,7 @@ func ChatEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fiber.Ctx)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if contentExists {
|
if contentExists {
|
||||||
content = fmt.Sprint(i.StringContent)
|
content = fmt.Sprint(*i.Content)
|
||||||
}
|
}
|
||||||
if i.FunctionCall != nil {
|
if i.FunctionCall != nil {
|
||||||
j, err := json.Marshal(i.FunctionCall)
|
j, err := json.Marshal(i.FunctionCall)
|
||||||
@@ -338,11 +334,7 @@ func ChatEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fiber.Ctx)
|
|||||||
// Otherwise ask the LLM to understand the JSON output and the context, and return a message
|
// Otherwise ask the LLM to understand the JSON output and the context, and return a message
|
||||||
// Note: This costs (in term of CPU) another computation
|
// Note: This costs (in term of CPU) another computation
|
||||||
config.Grammar = ""
|
config.Grammar = ""
|
||||||
images := []string{}
|
predFunc, err := backend.ModelInference(input.Context, predInput, o.Loader, *config, o, nil)
|
||||||
for _, m := range input.Messages {
|
|
||||||
images = append(images, m.StringImages...)
|
|
||||||
}
|
|
||||||
predFunc, err := backend.ModelInference(input.Context, predInput, images, o.Loader, *config, o, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Msgf("inference error: %s", err.Error())
|
log.Error().Msgf("inference error: %s", err.Error())
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
config "github.com/go-skynet/LocalAI/api/config"
|
config "github.com/go-skynet/LocalAI/api/config"
|
||||||
"github.com/go-skynet/LocalAI/api/options"
|
"github.com/go-skynet/LocalAI/api/options"
|
||||||
"github.com/go-skynet/LocalAI/api/schema"
|
"github.com/go-skynet/LocalAI/api/schema"
|
||||||
"github.com/go-skynet/LocalAI/pkg/grammar"
|
|
||||||
model "github.com/go-skynet/LocalAI/pkg/model"
|
model "github.com/go-skynet/LocalAI/pkg/model"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@@ -65,10 +64,6 @@ func CompletionEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fibe
|
|||||||
return fmt.Errorf("failed reading parameters from request:%w", err)
|
return fmt.Errorf("failed reading parameters from request:%w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.ResponseFormat == "json_object" {
|
|
||||||
input.Grammar = grammar.JSONBNF
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Debug().Msgf("Parameter Config: %+v", config)
|
log.Debug().Msgf("Parameter Config: %+v", config)
|
||||||
|
|
||||||
if input.Stream {
|
if input.Stream {
|
||||||
|
|||||||
@@ -23,13 +23,8 @@ func ComputeChoices(
|
|||||||
n = 1
|
n = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
images := []string{}
|
|
||||||
for _, m := range req.Messages {
|
|
||||||
images = append(images, m.StringImages...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the model function to call for the result
|
// get the model function to call for the result
|
||||||
predFunc, err := backend.ModelInference(req.Context, predInput, images, loader, *config, o, tokenCallback)
|
predFunc, err := backend.ModelInference(req.Context, predInput, loader, *config, o, tokenCallback)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, backend.TokenUsage{}, err
|
return result, backend.TokenUsage{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ package openai
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -27,7 +24,7 @@ func readInput(c *fiber.Ctx, o *options.Option, randomModel bool) (string, *sche
|
|||||||
input.Cancel = cancel
|
input.Cancel = cancel
|
||||||
// Get input data from the request body
|
// Get input data from the request body
|
||||||
if err := c.BodyParser(input); err != nil {
|
if err := c.BodyParser(input); err != nil {
|
||||||
return "", nil, fmt.Errorf("failed parsing request body: %w", err)
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
modelFile := input.Model
|
modelFile := input.Model
|
||||||
@@ -64,37 +61,6 @@ func readInput(c *fiber.Ctx, o *options.Option, randomModel bool) (string, *sche
|
|||||||
return modelFile, input, nil
|
return modelFile, input, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function check if the string is an URL, if it's an URL downloads the image in memory
|
|
||||||
// encodes it in base64 and returns the base64 string
|
|
||||||
func getBase64Image(s string) (string, error) {
|
|
||||||
if strings.HasPrefix(s, "http") {
|
|
||||||
// download the image
|
|
||||||
resp, err := http.Get(s)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
// read the image data into memory
|
|
||||||
data, err := ioutil.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
// encode the image data in base64
|
|
||||||
encoded := base64.StdEncoding.EncodeToString(data)
|
|
||||||
|
|
||||||
// return the base64 string
|
|
||||||
return encoded, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the string instead is prefixed with "data:image/jpeg;base64,", drop it
|
|
||||||
if strings.HasPrefix(s, "data:image/jpeg;base64,") {
|
|
||||||
return strings.ReplaceAll(s, "data:image/jpeg;base64,", ""), nil
|
|
||||||
}
|
|
||||||
return "", fmt.Errorf("not valid string")
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateConfig(config *config.Config, input *schema.OpenAIRequest) {
|
func updateConfig(config *config.Config, input *schema.OpenAIRequest) {
|
||||||
if input.Echo {
|
if input.Echo {
|
||||||
config.Echo = input.Echo
|
config.Echo = input.Echo
|
||||||
@@ -163,35 +129,6 @@ func updateConfig(config *config.Config, input *schema.OpenAIRequest) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode each request's message content
|
|
||||||
index := 0
|
|
||||||
for i, m := range input.Messages {
|
|
||||||
switch content := m.Content.(type) {
|
|
||||||
case string:
|
|
||||||
input.Messages[i].StringContent = content
|
|
||||||
case []interface{}:
|
|
||||||
dat, _ := json.Marshal(content)
|
|
||||||
c := []schema.Content{}
|
|
||||||
json.Unmarshal(dat, &c)
|
|
||||||
for _, pp := range c {
|
|
||||||
if pp.Type == "text" {
|
|
||||||
input.Messages[i].StringContent = pp.Text
|
|
||||||
} else if pp.Type == "image_url" {
|
|
||||||
// Detect if pp.ImageURL is an URL, if it is download the image and encode it in base64:
|
|
||||||
base64, err := getBase64Image(pp.ImageURL.URL)
|
|
||||||
if err == nil {
|
|
||||||
input.Messages[i].StringImages = append(input.Messages[i].StringImages, base64) // TODO: make sure that we only return base64 stuff
|
|
||||||
// set a placeholder for each image
|
|
||||||
input.Messages[i].StringContent = fmt.Sprintf("[img-%d]", index) + input.Messages[i].StringContent
|
|
||||||
index++
|
|
||||||
} else {
|
|
||||||
fmt.Print("Failed encoding image", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if input.RepeatPenalty != 0 {
|
if input.RepeatPenalty != 0 {
|
||||||
config.RepeatPenalty = input.RepeatPenalty
|
config.RepeatPenalty = input.RepeatPenalty
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
"github.com/go-skynet/LocalAI/pkg/gallery"
|
"github.com/go-skynet/LocalAI/pkg/gallery"
|
||||||
model "github.com/go-skynet/LocalAI/pkg/model"
|
model "github.com/go-skynet/LocalAI/pkg/model"
|
||||||
"github.com/go-skynet/LocalAI/metrics"
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -25,7 +24,6 @@ type Option struct {
|
|||||||
PreloadModelsFromPath string
|
PreloadModelsFromPath string
|
||||||
CORSAllowOrigins string
|
CORSAllowOrigins string
|
||||||
ApiKeys []string
|
ApiKeys []string
|
||||||
Metrics *metrics.Metrics
|
|
||||||
|
|
||||||
Galleries []gallery.Gallery
|
Galleries []gallery.Gallery
|
||||||
|
|
||||||
@@ -200,9 +198,3 @@ func WithApiKeys(apiKeys []string) AppOption {
|
|||||||
o.ApiKeys = apiKeys
|
o.ApiKeys = apiKeys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithMetrics(meter *metrics.Metrics) AppOption {
|
|
||||||
return func(o *Option) {
|
|
||||||
o.Metrics = meter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -55,25 +55,11 @@ type Choice struct {
|
|||||||
Text string `json:"text,omitempty"`
|
Text string `json:"text,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Content struct {
|
|
||||||
Type string `json:"type" yaml:"type"`
|
|
||||||
Text string `json:"text" yaml:"text"`
|
|
||||||
ImageURL ContentURL `json:"image_url" yaml:"image_url"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContentURL struct {
|
|
||||||
URL string `json:"url" yaml:"url"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
// The message role
|
// The message role
|
||||||
Role string `json:"role,omitempty" yaml:"role"`
|
Role string `json:"role,omitempty" yaml:"role"`
|
||||||
// The message content
|
// The message content
|
||||||
Content interface{} `json:"content" yaml:"content"`
|
Content *string `json:"content" yaml:"content"`
|
||||||
|
|
||||||
StringContent string `json:"string_content,omitempty" yaml:"string_content,omitempty"`
|
|
||||||
StringImages []string `json:"string_images,omitempty" yaml:"string_images,omitempty"`
|
|
||||||
|
|
||||||
// A result of a function call
|
// A result of a function call
|
||||||
FunctionCall interface{} `json:"function_call,omitempty" yaml:"function_call,omitempty"`
|
FunctionCall interface{} `json:"function_call,omitempty" yaml:"function_call,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
3
backend/cpp/grpc/.gitignore
vendored
3
backend/cpp/grpc/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
installed_packages/
|
|
||||||
grpc_build/
|
|
||||||
grpc_repo/
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Builds locally from sources the packages needed by the llama cpp backend.
|
|
||||||
|
|
||||||
# Makes sure a few base packages exist.
|
|
||||||
# sudo apt-get --no-upgrade -y install g++ gcc binutils cmake git build-essential autoconf libtool pkg-config
|
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
||||||
echo "Script directory: $SCRIPT_DIR"
|
|
||||||
|
|
||||||
CPP_INSTALLED_PACKAGES_DIR=$1
|
|
||||||
if [ -z ${CPP_INSTALLED_PACKAGES_DIR} ]; then
|
|
||||||
echo "CPP_INSTALLED_PACKAGES_DIR env variable not set. Don't know where to install: failed.";
|
|
||||||
echo
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "${CPP_INSTALLED_PACKAGES_DIR}" ]; then
|
|
||||||
echo "gRPC installation directory already exists. Nothing to do."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The depth when cloning a git repo. 1 speeds up the clone when the repo history is not needed.
|
|
||||||
GIT_CLONE_DEPTH=1
|
|
||||||
|
|
||||||
NUM_BUILD_THREADS=$(nproc --ignore=1)
|
|
||||||
|
|
||||||
# Google gRPC --------------------------------------------------------------------------------------
|
|
||||||
TAG_LIB_GRPC="v1.59.0"
|
|
||||||
GIT_REPO_LIB_GRPC="https://github.com/grpc/grpc.git"
|
|
||||||
GRPC_REPO_DIR="${SCRIPT_DIR}/../grpc_repo"
|
|
||||||
GRPC_BUILD_DIR="${SCRIPT_DIR}/../grpc_build"
|
|
||||||
SRC_DIR_LIB_GRPC="${GRPC_REPO_DIR}/grpc"
|
|
||||||
|
|
||||||
echo "SRC_DIR_LIB_GRPC: ${SRC_DIR_LIB_GRPC}"
|
|
||||||
echo "GRPC_REPO_DIR: ${GRPC_REPO_DIR}"
|
|
||||||
echo "GRPC_BUILD_DIR: ${GRPC_BUILD_DIR}"
|
|
||||||
|
|
||||||
mkdir -pv ${GRPC_REPO_DIR}
|
|
||||||
|
|
||||||
rm -rf ${GRPC_BUILD_DIR}
|
|
||||||
mkdir -pv ${GRPC_BUILD_DIR}
|
|
||||||
|
|
||||||
mkdir -pv ${CPP_INSTALLED_PACKAGES_DIR}
|
|
||||||
|
|
||||||
if [ -d "${SRC_DIR_LIB_GRPC}" ]; then
|
|
||||||
echo "gRPC source already exists locally. Not cloned again."
|
|
||||||
else
|
|
||||||
( cd ${GRPC_REPO_DIR} && \
|
|
||||||
git clone --depth ${GIT_CLONE_DEPTH} -b ${TAG_LIB_GRPC} ${GIT_REPO_LIB_GRPC} && \
|
|
||||||
cd ${SRC_DIR_LIB_GRPC} && \
|
|
||||||
git submodule update --init --recursive --depth ${GIT_CLONE_DEPTH}
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
( cd ${GRPC_BUILD_DIR} && \
|
|
||||||
cmake -G "Unix Makefiles" \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DgRPC_INSTALL=ON \
|
|
||||||
-DEXECUTABLE_OUTPUT_PATH=${CPP_INSTALLED_PACKAGES_DIR}/grpc/bin \
|
|
||||||
-DLIBRARY_OUTPUT_PATH=${CPP_INSTALLED_PACKAGES_DIR}/grpc/lib \
|
|
||||||
-DgRPC_BUILD_TESTS=OFF \
|
|
||||||
-DgRPC_BUILD_CSHARP_EXT=OFF \
|
|
||||||
-DgRPC_BUILD_GRPC_CPP_PLUGIN=ON \
|
|
||||||
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \
|
|
||||||
-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \
|
|
||||||
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
|
|
||||||
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \
|
|
||||||
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=ON \
|
|
||||||
-DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \
|
|
||||||
-Dprotobuf_WITH_ZLIB=ON \
|
|
||||||
-DRE2_BUILD_TESTING=OFF \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=${CPP_INSTALLED_PACKAGES_DIR}/ \
|
|
||||||
${SRC_DIR_LIB_GRPC} && \
|
|
||||||
cmake --build . -- -j ${NUM_BUILD_THREADS} && \
|
|
||||||
cmake --build . --target install -- -j ${NUM_BUILD_THREADS}
|
|
||||||
)
|
|
||||||
|
|
||||||
rm -rf ${GRPC_BUILD_DIR}
|
|
||||||
rm -rf ${GRPC_REPO_DIR}
|
|
||||||
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
|
|
||||||
## XXX: In some versions of CMake clip wasn't being built before llama.
|
|
||||||
## This is an hack for now, but it should be fixed in the future.
|
|
||||||
set(TARGET myclip)
|
|
||||||
add_library(${TARGET} clip.cpp clip.h)
|
|
||||||
install(TARGETS ${TARGET} LIBRARY)
|
|
||||||
target_link_libraries(${TARGET} PRIVATE common ggml ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
target_compile_features(${TARGET} PRIVATE cxx_std_11)
|
|
||||||
if (NOT MSVC)
|
|
||||||
target_compile_options(${TARGET} PRIVATE -Wno-cast-qual) # stb_image.h
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(TARGET grpc-server)
|
|
||||||
# END CLIP hack
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
|
||||||
set(TARGET grpc-server)
|
|
||||||
set(_PROTOBUF_LIBPROTOBUF libprotobuf)
|
|
||||||
set(_REFLECTION grpc++_reflection)
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
link_directories("/opt/homebrew/lib")
|
|
||||||
include_directories("/opt/homebrew/include")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(absl CONFIG REQUIRED)
|
|
||||||
find_package(Protobuf CONFIG REQUIRED)
|
|
||||||
find_package(gRPC CONFIG REQUIRED)
|
|
||||||
|
|
||||||
find_program(_PROTOBUF_PROTOC protoc)
|
|
||||||
set(_GRPC_GRPCPP grpc++)
|
|
||||||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
include_directories(${Protobuf_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
message(STATUS "Using protobuf version ${Protobuf_VERSION} | Protobuf_INCLUDE_DIRS: ${Protobuf_INCLUDE_DIRS} | CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
|
|
||||||
# Proto file
|
|
||||||
get_filename_component(hw_proto "../../../../../../pkg/grpc/proto/backend.proto" ABSOLUTE)
|
|
||||||
get_filename_component(hw_proto_path "${hw_proto}" PATH)
|
|
||||||
|
|
||||||
# Generated sources
|
|
||||||
set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/backend.pb.cc")
|
|
||||||
set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/backend.pb.h")
|
|
||||||
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/backend.grpc.pb.cc")
|
|
||||||
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/backend.grpc.pb.h")
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
|
|
||||||
COMMAND ${_PROTOBUF_PROTOC}
|
|
||||||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
|
|
||||||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
|
|
||||||
-I "${hw_proto_path}"
|
|
||||||
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
|
|
||||||
"${hw_proto}"
|
|
||||||
DEPENDS "${hw_proto}")
|
|
||||||
|
|
||||||
# hw_grpc_proto
|
|
||||||
add_library(hw_grpc_proto
|
|
||||||
${hw_grpc_srcs}
|
|
||||||
${hw_grpc_hdrs}
|
|
||||||
${hw_proto_srcs}
|
|
||||||
${hw_proto_hdrs} )
|
|
||||||
|
|
||||||
add_executable(${TARGET} grpc-server.cpp json.hpp )
|
|
||||||
target_link_libraries(${TARGET} PRIVATE common llama myclip ${CMAKE_THREAD_LIBS_INIT} absl::flags hw_grpc_proto
|
|
||||||
absl::flags_parse
|
|
||||||
gRPC::${_REFLECTION}
|
|
||||||
gRPC::${_GRPC_GRPCPP}
|
|
||||||
protobuf::${_PROTOBUF_LIBPROTOBUF})
|
|
||||||
target_compile_features(${TARGET} PRIVATE cxx_std_11)
|
|
||||||
if(TARGET BUILD_INFO)
|
|
||||||
add_dependencies(${TARGET} BUILD_INFO)
|
|
||||||
endif()
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
|
|
||||||
LLAMA_VERSION?=d9b33fe95bd257b36c84ee5769cc048230067d6f
|
|
||||||
|
|
||||||
CMAKE_ARGS?=
|
|
||||||
BUILD_TYPE?=
|
|
||||||
|
|
||||||
# If build type is cublas, then we set -DLLAMA_CUBLAS=ON to CMAKE_ARGS automatically
|
|
||||||
ifeq ($(BUILD_TYPE),cublas)
|
|
||||||
CMAKE_ARGS+=-DLLAMA_CUBLAS=ON
|
|
||||||
# If build type is openblas then we set -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS
|
|
||||||
# to CMAKE_ARGS automatically
|
|
||||||
else ifeq ($(BUILD_TYPE),openblas)
|
|
||||||
CMAKE_ARGS+=-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS
|
|
||||||
# If build type is clblast (openCL) we set -DLLAMA_CLBLAST=ON -DCLBlast_DIR=/some/path
|
|
||||||
else ifeq ($(BUILD_TYPE),clblast)
|
|
||||||
CMAKE_ARGS+=-DLLAMA_CLBLAST=ON -DCLBlast_DIR=/some/path
|
|
||||||
# If it's hipblas we do have also to set CC=/opt/rocm/llvm/bin/clang CXX=/opt/rocm/llvm/bin/clang++
|
|
||||||
else ifeq ($(BUILD_TYPE),hipblas)
|
|
||||||
CMAKE_ARGS+=-DLLAMA_HIPBLAS=ON
|
|
||||||
endif
|
|
||||||
|
|
||||||
llama.cpp:
|
|
||||||
git clone --recurse-submodules https://github.com/ggerganov/llama.cpp llama.cpp
|
|
||||||
cd llama.cpp && git checkout -b build $(LLAMA_VERSION) && git submodule update --init --recursive --depth 1
|
|
||||||
|
|
||||||
llama.cpp/examples/grpc-server:
|
|
||||||
mkdir -p llama.cpp/examples/grpc-server
|
|
||||||
cp -r $(abspath ./)/CMakeLists.txt llama.cpp/examples/grpc-server/
|
|
||||||
cp -r $(abspath ./)/grpc-server.cpp llama.cpp/examples/grpc-server/
|
|
||||||
cp -rfv $(abspath ./)/json.hpp llama.cpp/examples/grpc-server/
|
|
||||||
echo "add_subdirectory(grpc-server)" >> llama.cpp/examples/CMakeLists.txt
|
|
||||||
## XXX: In some versions of CMake clip wasn't being built before llama.
|
|
||||||
## This is an hack for now, but it should be fixed in the future.
|
|
||||||
cp -rfv llama.cpp/examples/llava/clip.h llama.cpp/examples/grpc-server/clip.h
|
|
||||||
cp -rfv llama.cpp/examples/llava/clip.cpp llama.cpp/examples/grpc-server/clip.cpp
|
|
||||||
|
|
||||||
rebuild:
|
|
||||||
cp -rfv $(abspath ./)/CMakeLists.txt llama.cpp/examples/grpc-server/
|
|
||||||
cp -rfv $(abspath ./)/grpc-server.cpp llama.cpp/examples/grpc-server/
|
|
||||||
cp -rfv $(abspath ./)/json.hpp llama.cpp/examples/grpc-server/
|
|
||||||
rm -rf grpc-server
|
|
||||||
$(MAKE) grpc-server
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf llama.cpp
|
|
||||||
rm -rf grpc-server
|
|
||||||
|
|
||||||
grpc-server: llama.cpp llama.cpp/examples/grpc-server
|
|
||||||
cd llama.cpp && mkdir -p build && cd build && cmake .. $(CMAKE_ARGS) && cmake --build . --config Release
|
|
||||||
cp llama.cpp/build/bin/grpc-server .
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
23
cmd/grpc/bloomz/main.go
Normal file
23
cmd/grpc/bloomz/main.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// Note: this is started internally by LocalAI and a server is allocated for each model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
|
||||||
|
bloomz "github.com/go-skynet/LocalAI/pkg/backend/llm/bloomz"
|
||||||
|
|
||||||
|
grpc "github.com/go-skynet/LocalAI/pkg/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
addr = flag.String("addr", "localhost:50051", "the address to connect to")
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if err := grpc.StartServer(*addr, &bloomz.LLM{}); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
25
cmd/grpc/falcon/main.go
Normal file
25
cmd/grpc/falcon/main.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// GRPC Falcon server
|
||||||
|
|
||||||
|
// Note: this is started internally by LocalAI and a server is allocated for each model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
|
||||||
|
falcon "github.com/go-skynet/LocalAI/pkg/backend/llm/falcon"
|
||||||
|
|
||||||
|
grpc "github.com/go-skynet/LocalAI/pkg/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
addr = flag.String("addr", "localhost:50051", "the address to connect to")
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if err := grpc.StartServer(*addr, &falcon.LLM{}); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ cd /build
|
|||||||
|
|
||||||
if [ "$REBUILD" != "false" ]; then
|
if [ "$REBUILD" != "false" ]; then
|
||||||
rm -rf ./local-ai
|
rm -rf ./local-ai
|
||||||
make build -j${BUILD_PARALLELISM:-1}
|
ESPEAK_DATA=/build/lib/Linux-$(uname -m)/piper_phonemize/lib/espeak-ng-data make build -j${BUILD_PARALLELISM:-1}
|
||||||
else
|
else
|
||||||
echo "@@@@@"
|
echo "@@@@@"
|
||||||
echo "Skipping rebuild"
|
echo "Skipping rebuild"
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Generate image
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: {{PROTOCOL}}{{HOST}}:{{PORT}}/v1/images/generations
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
headers {
|
|
||||||
Content-Type: application/json
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"prompt": "<positive prompt>|<negative prompt>",
|
|
||||||
"model": "model-name",
|
|
||||||
"step": 51,
|
|
||||||
"size": "1024x1024",
|
|
||||||
"image": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,16 +15,10 @@ headers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"model": "{{DEFAULT_MODEL}}",
|
"model": "{{DEFAULT_MODEL}}",
|
||||||
"messages": [
|
"messages": [{"role": "user", "content": "How could one use friction to cook an egg?"}],
|
||||||
{
|
"max_tokens": 256,
|
||||||
"role": "user",
|
"temperature": 0.2
|
||||||
"content": "How could one use friction to cook an egg?"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"max_tokens": 256,
|
|
||||||
"temperature": 0.2,
|
|
||||||
"grammar": ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
# Use an official Python runtime as a parent image
|
|
||||||
FROM harbor.home.sfxworks.net/docker/library/python:3.9-slim
|
|
||||||
|
|
||||||
# Set the working directory in the container
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy the current directory contents into the container at /app
|
|
||||||
COPY requirements.txt /app
|
|
||||||
|
|
||||||
# Install any needed packages specified in requirements.txt
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
|
|
||||||
# Run app.py when the container launches
|
|
||||||
CMD ["chainlit", "run", "-h", "--host", "0.0.0.0", "main.py" ]
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# LocalAI Demonstration with Embeddings and Chainlit
|
|
||||||
|
|
||||||
This demonstration shows you how to use embeddings with existing data in `LocalAI`, and how to integrate it with Chainlit for an interactive querying experience. We are using the `llama_index` library to facilitate the embedding and querying processes, and `chainlit` to provide an interactive interface. The `Weaviate` client is used as the embedding source.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
Before proceeding, make sure you have the following installed:
|
|
||||||
- Weaviate client
|
|
||||||
- LocalAI and its dependencies
|
|
||||||
- Chainlit and its dependencies
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
1. Clone this repository:
|
|
||||||
2. Navigate to the project directory:
|
|
||||||
3. Run the example: `chainlit run main.py`
|
|
||||||
|
|
||||||
# Highlight on `llama_index` and `chainlit`
|
|
||||||
|
|
||||||
`llama_index` is the key library that facilitates the process of embedding and querying data in LocalAI. It provides a seamless interface to integrate various components, such as `WeaviateVectorStore`, `LocalAI`, `ServiceContext`, and more, for a smooth querying experience.
|
|
||||||
|
|
||||||
`chainlit` is used to provide an interactive interface for users to query the data and see the results in real-time. It integrates with llama_index to handle the querying process and display the results to the user.
|
|
||||||
|
|
||||||
In this example, `llama_index` is used to set up the `VectorStoreIndex` and `QueryEngine`, and `chainlit` is used to handle the user interactions with `LocalAI` and display the results.
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
localAI:
|
|
||||||
temperature: 0
|
|
||||||
modelName: gpt-3.5-turbo
|
|
||||||
apiBase: http://local-ai.default
|
|
||||||
apiKey: stub
|
|
||||||
streaming: True
|
|
||||||
weviate:
|
|
||||||
url: http://weviate.local
|
|
||||||
index: AIChroma
|
|
||||||
query:
|
|
||||||
mode: hybrid
|
|
||||||
topK: 1
|
|
||||||
alpha: 0.0
|
|
||||||
chunkSize: 1024
|
|
||||||
embedding:
|
|
||||||
model: BAAI/bge-small-en-v1.5
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
import weaviate
|
|
||||||
from llama_index.storage.storage_context import StorageContext
|
|
||||||
from llama_index.vector_stores import WeaviateVectorStore
|
|
||||||
|
|
||||||
from llama_index.query_engine.retriever_query_engine import RetrieverQueryEngine
|
|
||||||
from llama_index.callbacks.base import CallbackManager
|
|
||||||
from llama_index import (
|
|
||||||
LLMPredictor,
|
|
||||||
ServiceContext,
|
|
||||||
StorageContext,
|
|
||||||
VectorStoreIndex,
|
|
||||||
)
|
|
||||||
import chainlit as cl
|
|
||||||
|
|
||||||
from llama_index.llms import LocalAI
|
|
||||||
from llama_index.embeddings import HuggingFaceEmbedding
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
# Load the configuration file
|
|
||||||
with open("config.yaml", "r") as ymlfile:
|
|
||||||
cfg = yaml.safe_load(ymlfile)
|
|
||||||
|
|
||||||
# Get the values from the configuration file or set the default values
|
|
||||||
temperature = cfg['localAI'].get('temperature', 0)
|
|
||||||
model_name = cfg['localAI'].get('modelName', "gpt-3.5-turbo")
|
|
||||||
api_base = cfg['localAI'].get('apiBase', "http://local-ai.default")
|
|
||||||
api_key = cfg['localAI'].get('apiKey', "stub")
|
|
||||||
streaming = cfg['localAI'].get('streaming', True)
|
|
||||||
weaviate_url = cfg['weviate'].get('url', "http://weviate.default")
|
|
||||||
index_name = cfg['weviate'].get('index', "AIChroma")
|
|
||||||
query_mode = cfg['query'].get('mode', "hybrid")
|
|
||||||
topK = cfg['query'].get('topK', 1)
|
|
||||||
alpha = cfg['query'].get('alpha', 0.0)
|
|
||||||
embed_model_name = cfg['embedding'].get('model', "BAAI/bge-small-en-v1.5")
|
|
||||||
chunk_size = cfg['query'].get('chunkSize', 1024)
|
|
||||||
|
|
||||||
|
|
||||||
embed_model = HuggingFaceEmbedding(model_name=embed_model_name)
|
|
||||||
|
|
||||||
|
|
||||||
llm = LocalAI(temperature=temperature, model_name=model_name, api_base=api_base, api_key=api_key, streaming=streaming)
|
|
||||||
llm.globally_use_chat_completions = True;
|
|
||||||
client = weaviate.Client(weaviate_url)
|
|
||||||
vector_store = WeaviateVectorStore(weaviate_client=client, index_name=index_name)
|
|
||||||
storage_context = StorageContext.from_defaults(vector_store=vector_store)
|
|
||||||
|
|
||||||
@cl.on_chat_start
|
|
||||||
async def factory():
|
|
||||||
|
|
||||||
llm_predictor = LLMPredictor(
|
|
||||||
llm=llm
|
|
||||||
)
|
|
||||||
|
|
||||||
service_context = ServiceContext.from_defaults(embed_model=embed_model, callback_manager=CallbackManager([cl.LlamaIndexCallbackHandler()]), llm_predictor=llm_predictor, chunk_size=chunk_size)
|
|
||||||
|
|
||||||
index = VectorStoreIndex.from_vector_store(
|
|
||||||
vector_store,
|
|
||||||
storage_context=storage_context,
|
|
||||||
service_context=service_context
|
|
||||||
)
|
|
||||||
|
|
||||||
query_engine = index.as_query_engine(vector_store_query_mode=query_mode, similarity_top_k=topK, alpha=alpha, streaming=True)
|
|
||||||
|
|
||||||
cl.user_session.set("query_engine", query_engine)
|
|
||||||
|
|
||||||
|
|
||||||
@cl.on_message
|
|
||||||
async def main(message: cl.Message):
|
|
||||||
query_engine = cl.user_session.get("query_engine")
|
|
||||||
response = await cl.make_async(query_engine.query)(message.content)
|
|
||||||
|
|
||||||
response_message = cl.Message(content="")
|
|
||||||
|
|
||||||
for token in response.response_gen:
|
|
||||||
await response_message.stream_token(token=token)
|
|
||||||
|
|
||||||
if response.response_txt:
|
|
||||||
response_message.content = response.response_txt
|
|
||||||
|
|
||||||
await response_message.send()
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
llama_hub==0.0.41
|
|
||||||
llama_index==0.8.55
|
|
||||||
Requests==2.31.0
|
|
||||||
weaviate_client==3.25.1
|
|
||||||
transformers
|
|
||||||
torch
|
|
||||||
chainlit
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
## Advanced configuration
|
|
||||||
|
|
||||||
This section contains examples on how to install models manually with config files.
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
First clone LocalAI:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/go-skynet/LocalAI
|
|
||||||
|
|
||||||
cd LocalAI
|
|
||||||
```
|
|
||||||
|
|
||||||
Setup the model you prefer from the examples below and then start LocalAI:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker compose up -d --pull always
|
|
||||||
```
|
|
||||||
|
|
||||||
If LocalAI is already started, you can restart it with
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker compose restart
|
|
||||||
```
|
|
||||||
|
|
||||||
See also the getting started: https://localai.io/basics/getting_started/
|
|
||||||
|
|
||||||
### Mistral
|
|
||||||
|
|
||||||
To setup mistral copy the files inside `mistral` in the `models` folder:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp -r examples/configurations/mistral/* models/
|
|
||||||
```
|
|
||||||
|
|
||||||
Now download the model:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
wget https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/resolve/main/mistral-7b-openorca.Q6_K.gguf -O models/mistral-7b-openorca.Q6_K.gguf
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||

|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
```
|
|
||||||
mkdir models
|
|
||||||
wget https://huggingface.co/mys/ggml_bakllava-1/resolve/main/ggml-model-q4_k.gguf -O models/ggml-model-q4_k.gguf
|
|
||||||
wget https://huggingface.co/mys/ggml_bakllava-1/resolve/main/mmproj-model-f16.gguf -O models/mmproj-model-f16.gguf
|
|
||||||
docker run -p 8080:8080 -v $PWD/models:/models -ti --rm quay.io/go-skynet/local-ai:master --models-path /models --threads 4
|
|
||||||
```
|
|
||||||
|
|
||||||
## Try it out
|
|
||||||
|
|
||||||
```
|
|
||||||
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
|
|
||||||
"model": "llava",
|
|
||||||
"messages": [{"role": "user", "content": [{"type":"text", "text": "What is in the image?"}, {"type": "image_url", "image_url": {"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" }}], "temperature": 0.9}]}'
|
|
||||||
```
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.
|
|
||||||
{{.Input}}
|
|
||||||
ASSISTANT:
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
context_size: 4096
|
|
||||||
f16: true
|
|
||||||
threads: 11
|
|
||||||
gpu_layers: 90
|
|
||||||
name: llava
|
|
||||||
mmap: true
|
|
||||||
backend: llama-cpp
|
|
||||||
roles:
|
|
||||||
user: "USER:"
|
|
||||||
assistant: "ASSISTANT:"
|
|
||||||
system: "SYSTEM:"
|
|
||||||
parameters:
|
|
||||||
model: ggml-model-q4_k.gguf
|
|
||||||
temperature: 0.2
|
|
||||||
top_k: 40
|
|
||||||
top_p: 0.95
|
|
||||||
template:
|
|
||||||
chat: chat-simple
|
|
||||||
mmproj: mmproj-model-f16.gguf
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{{.Input}}
|
|
||||||
<|im_start|>assistant
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "user"}}user{{end}}
|
|
||||||
{{if .Content}}{{.Content}}{{end}}
|
|
||||||
<|im_end|>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{{.Input}}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
name: mistral
|
|
||||||
mmap: true
|
|
||||||
parameters:
|
|
||||||
model: mistral-7b-openorca.Q6_K.gguf
|
|
||||||
temperature: 0.2
|
|
||||||
top_k: 40
|
|
||||||
top_p: 0.95
|
|
||||||
template:
|
|
||||||
chat_message: chatml
|
|
||||||
chat: chatml-block
|
|
||||||
completion: completion
|
|
||||||
context_size: 4096
|
|
||||||
f16: true
|
|
||||||
stopwords:
|
|
||||||
- <|im_end|>
|
|
||||||
threads: 4
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# LocalAI Demonstration with Embeddings
|
|
||||||
|
|
||||||
This demonstration shows you how to use embeddings with existing data in LocalAI. We are using the `llama_index` library to facilitate the embedding and querying processes. The `Weaviate` client is used as the embedding source.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
Before proceeding, make sure you have the following installed:
|
|
||||||
- Weaviate client
|
|
||||||
- LocalAI and its dependencies
|
|
||||||
- llama_index and its dependencies
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
1. Clone this repository:
|
|
||||||
|
|
||||||
2. Navigate to the project directory:
|
|
||||||
|
|
||||||
3. Run the example:
|
|
||||||
|
|
||||||
`python main.py`
|
|
||||||
|
|
||||||
```
|
|
||||||
Downloading (…)lve/main/config.json: 100%|███████████████████████████| 684/684 [00:00<00:00, 6.01MB/s]
|
|
||||||
Downloading model.safetensors: 100%|███████████████████████████████| 133M/133M [00:03<00:00, 39.5MB/s]
|
|
||||||
Downloading (…)okenizer_config.json: 100%|███████████████████████████| 366/366 [00:00<00:00, 2.79MB/s]
|
|
||||||
Downloading (…)solve/main/vocab.txt: 100%|█████████████████████████| 232k/232k [00:00<00:00, 6.00MB/s]
|
|
||||||
Downloading (…)/main/tokenizer.json: 100%|█████████████████████████| 711k/711k [00:00<00:00, 18.8MB/s]
|
|
||||||
Downloading (…)cial_tokens_map.json: 100%|███████████████████████████| 125/125 [00:00<00:00, 1.18MB/s]
|
|
||||||
LocalAI is a community-driven project that aims to make AI accessible to everyone. It was created by Ettore Di Giacinto and is focused on providing various AI-related features such as text generation with GPTs, text to audio, audio to text, image generation, and more. The project is constantly growing and evolving, with a roadmap for future improvements. Anyone is welcome to contribute, provide feedback, and submit pull requests to help make LocalAI better.
|
|
||||||
```
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
import weaviate
|
|
||||||
|
|
||||||
from llama_index import ServiceContext, VectorStoreIndex, StorageContext
|
|
||||||
from llama_index.llms import LocalAI
|
|
||||||
from llama_index.vector_stores import WeaviateVectorStore
|
|
||||||
from llama_index.storage.storage_context import StorageContext
|
|
||||||
|
|
||||||
# Weaviate client setup
|
|
||||||
client = weaviate.Client("http://weviate.default")
|
|
||||||
|
|
||||||
# Weaviate vector store setup
|
|
||||||
vector_store = WeaviateVectorStore(weaviate_client=client, index_name="AIChroma")
|
|
||||||
|
|
||||||
# Storage context setup
|
|
||||||
storage_context = StorageContext.from_defaults(vector_store=vector_store)
|
|
||||||
|
|
||||||
# LocalAI setup
|
|
||||||
llm = LocalAI(temperature=0, model_name="gpt-3.5-turbo", api_base="http://local-ai.default", api_key="stub")
|
|
||||||
llm.globally_use_chat_completions = True;
|
|
||||||
|
|
||||||
# Service context setup
|
|
||||||
service_context = ServiceContext.from_defaults(llm=llm, embed_model="local")
|
|
||||||
|
|
||||||
# Load index from stored vectors
|
|
||||||
index = VectorStoreIndex.from_vector_store(
|
|
||||||
vector_store,
|
|
||||||
storage_context=storage_context,
|
|
||||||
service_context=service_context
|
|
||||||
)
|
|
||||||
|
|
||||||
# Query engine setup
|
|
||||||
query_engine = index.as_query_engine(similarity_top_k=1, vector_store_query_mode="hybrid")
|
|
||||||
|
|
||||||
# Query example
|
|
||||||
response = query_engine.query("What is LocalAI?")
|
|
||||||
print(response)
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
# Common commands about conda environment
|
|
||||||
|
|
||||||
## Create a new empty conda environment
|
|
||||||
|
|
||||||
```
|
|
||||||
conda create --name <env-name> python=<your version> -y
|
|
||||||
|
|
||||||
conda create --name autogptq python=3.11 -y
|
|
||||||
```
|
|
||||||
|
|
||||||
## To activate the environment
|
|
||||||
|
|
||||||
As of conda 4.4
|
|
||||||
```
|
|
||||||
conda activate autogptq
|
|
||||||
```
|
|
||||||
|
|
||||||
The conda version older than 4.4
|
|
||||||
|
|
||||||
```
|
|
||||||
source activate autogptq
|
|
||||||
```
|
|
||||||
|
|
||||||
## Install the packages to your environment
|
|
||||||
|
|
||||||
Sometimes you need to install the packages from the conda-forge channel
|
|
||||||
|
|
||||||
By using `conda`
|
|
||||||
```
|
|
||||||
conda install <your-package-name>
|
|
||||||
|
|
||||||
conda install -c conda-forge <your package-name>
|
|
||||||
```
|
|
||||||
|
|
||||||
Or by using `pip`
|
|
||||||
```
|
|
||||||
pip install <your-package-name>
|
|
||||||
```
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
.PONY: autogptq
|
|
||||||
autogptq:
|
|
||||||
@echo "Creating virtual environment..."
|
|
||||||
@conda env create --name autogptq --file autogptq.yml
|
|
||||||
@echo "Virtual environment created."
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Creating a separate environment for the autogptq project
|
|
||||||
|
|
||||||
```
|
|
||||||
make autogptq
|
|
||||||
```
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import grpc
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
import time
|
||||||
|
import backend_pb2
|
||||||
|
import backend_pb2_grpc
|
||||||
import argparse
|
import argparse
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import time
|
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
||||||
|
from pathlib import Path
|
||||||
import grpc
|
|
||||||
import backend_pb2
|
|
||||||
import backend_pb2_grpc
|
|
||||||
from auto_gptq import AutoGPTQForCausalLM
|
|
||||||
from transformers import AutoTokenizer
|
from transformers import AutoTokenizer
|
||||||
from transformers import TextGenerationPipeline
|
from transformers import TextGenerationPipeline
|
||||||
|
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
name: autogptq
|
|
||||||
channels:
|
|
||||||
- defaults
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=main
|
|
||||||
- _openmp_mutex=5.1=1_gnu
|
|
||||||
- bzip2=1.0.8=h7b6447c_0
|
|
||||||
- ca-certificates=2023.08.22=h06a4308_0
|
|
||||||
- ld_impl_linux-64=2.38=h1181459_1
|
|
||||||
- libffi=3.4.4=h6a678d5_0
|
|
||||||
- libgcc-ng=11.2.0=h1234567_1
|
|
||||||
- libgomp=11.2.0=h1234567_1
|
|
||||||
- libstdcxx-ng=11.2.0=h1234567_1
|
|
||||||
- libuuid=1.41.5=h5eee18b_0
|
|
||||||
- ncurses=6.4=h6a678d5_0
|
|
||||||
- openssl=3.0.11=h7f8727e_2
|
|
||||||
- pip=23.2.1=py311h06a4308_0
|
|
||||||
- python=3.11.5=h955ad1f_0
|
|
||||||
- readline=8.2=h5eee18b_0
|
|
||||||
- setuptools=68.0.0=py311h06a4308_0
|
|
||||||
- sqlite=3.41.2=h5eee18b_0
|
|
||||||
- tk=8.6.12=h1ccaba5_0
|
|
||||||
- wheel=0.41.2=py311h06a4308_0
|
|
||||||
- xz=5.4.2=h5eee18b_0
|
|
||||||
- zlib=1.2.13=h5eee18b_0
|
|
||||||
- pip:
|
|
||||||
- accelerate==0.23.0
|
|
||||||
- aiohttp==3.8.5
|
|
||||||
- aiosignal==1.3.1
|
|
||||||
- async-timeout==4.0.3
|
|
||||||
- attrs==23.1.0
|
|
||||||
- auto-gptq==0.4.2
|
|
||||||
- certifi==2023.7.22
|
|
||||||
- charset-normalizer==3.3.0
|
|
||||||
- datasets==2.14.5
|
|
||||||
- dill==0.3.7
|
|
||||||
- filelock==3.12.4
|
|
||||||
- frozenlist==1.4.0
|
|
||||||
- fsspec==2023.6.0
|
|
||||||
- grpcio==1.59.0
|
|
||||||
- huggingface-hub==0.16.4
|
|
||||||
- idna==3.4
|
|
||||||
- jinja2==3.1.2
|
|
||||||
- markupsafe==2.1.3
|
|
||||||
- mpmath==1.3.0
|
|
||||||
- multidict==6.0.4
|
|
||||||
- multiprocess==0.70.15
|
|
||||||
- networkx==3.1
|
|
||||||
- numpy==1.26.0
|
|
||||||
- nvidia-cublas-cu12==12.1.3.1
|
|
||||||
- nvidia-cuda-cupti-cu12==12.1.105
|
|
||||||
- nvidia-cuda-nvrtc-cu12==12.1.105
|
|
||||||
- nvidia-cuda-runtime-cu12==12.1.105
|
|
||||||
- nvidia-cudnn-cu12==8.9.2.26
|
|
||||||
- nvidia-cufft-cu12==11.0.2.54
|
|
||||||
- nvidia-curand-cu12==10.3.2.106
|
|
||||||
- nvidia-cusolver-cu12==11.4.5.107
|
|
||||||
- nvidia-cusparse-cu12==12.1.0.106
|
|
||||||
- nvidia-nccl-cu12==2.18.1
|
|
||||||
- nvidia-nvjitlink-cu12==12.2.140
|
|
||||||
- nvidia-nvtx-cu12==12.1.105
|
|
||||||
- packaging==23.2
|
|
||||||
- pandas==2.1.1
|
|
||||||
- peft==0.5.0
|
|
||||||
- protobuf==4.24.4
|
|
||||||
- psutil==5.9.5
|
|
||||||
- pyarrow==13.0.0
|
|
||||||
- python-dateutil==2.8.2
|
|
||||||
- pytz==2023.3.post1
|
|
||||||
- pyyaml==6.0.1
|
|
||||||
- regex==2023.10.3
|
|
||||||
- requests==2.31.0
|
|
||||||
- rouge==1.0.1
|
|
||||||
- safetensors==0.3.3
|
|
||||||
- six==1.16.0
|
|
||||||
- sympy==1.12
|
|
||||||
- tokenizers==0.14.0
|
|
||||||
- torch==2.1.0
|
|
||||||
- tqdm==4.66.1
|
|
||||||
- transformers==4.34.0
|
|
||||||
- triton==2.1.0
|
|
||||||
- typing-extensions==4.8.0
|
|
||||||
- tzdata==2023.3
|
|
||||||
- urllib3==2.0.6
|
|
||||||
- xxhash==3.4.1
|
|
||||||
- yarl==1.9.2
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the autogptq server with conda
|
|
||||||
|
|
||||||
export PATH=$PATH:/opt/conda/bin
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate autogptq
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python $DIR/autogptq.py $@
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
.PONY: ttsbark
|
|
||||||
ttsbark:
|
|
||||||
@echo "Creating virtual environment..."
|
|
||||||
@conda env create --name ttsbark --file ttsbark.yml
|
|
||||||
@echo "Virtual environment created."
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
# Creating a separate environment for ttsbark project
|
|
||||||
|
|
||||||
```
|
|
||||||
make ttsbark
|
|
||||||
```
|
|
||||||
|
|
||||||
# Testing the gRPC server
|
|
||||||
|
|
||||||
```
|
|
||||||
<The path of your python interpreter> -m unittest test_ttsbark.py
|
|
||||||
```
|
|
||||||
|
|
||||||
For example
|
|
||||||
```
|
|
||||||
/opt/conda/envs/bark/bin/python -m unittest extra/grpc/bark/test_ttsbark.py
|
|
||||||
``````
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the ttsbark server with conda
|
|
||||||
|
|
||||||
export PATH=$PATH:/opt/conda/bin
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate ttsbark
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python $DIR/ttsbark.py $@
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import unittest
|
|
||||||
import subprocess
|
|
||||||
import time
|
|
||||||
import backend_pb2
|
|
||||||
import backend_pb2_grpc
|
|
||||||
|
|
||||||
import grpc
|
|
||||||
|
|
||||||
class TestBackendServicer(unittest.TestCase):
|
|
||||||
"""
|
|
||||||
TestBackendServicer is the class that tests the gRPC service
|
|
||||||
"""
|
|
||||||
def setUp(self):
|
|
||||||
self.service = subprocess.Popen(["python3", "ttsbark.py", "--addr", "localhost:50051"])
|
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
|
||||||
self.service.terminate()
|
|
||||||
self.service.wait()
|
|
||||||
|
|
||||||
def test_server_startup(self):
|
|
||||||
time.sleep(2)
|
|
||||||
try:
|
|
||||||
self.setUp()
|
|
||||||
with grpc.insecure_channel("localhost:50051") as channel:
|
|
||||||
stub = backend_pb2_grpc.BackendStub(channel)
|
|
||||||
response = stub.Health(backend_pb2.HealthMessage())
|
|
||||||
self.assertEqual(response.message, b'OK')
|
|
||||||
except Exception as err:
|
|
||||||
print(err)
|
|
||||||
self.fail("Server failed to start")
|
|
||||||
finally:
|
|
||||||
self.tearDown()
|
|
||||||
@@ -1,22 +1,17 @@
|
|||||||
"""
|
|
||||||
This is the extra gRPC server of LocalAI
|
|
||||||
"""
|
|
||||||
|
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import grpc
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
import time
|
import time
|
||||||
|
import backend_pb2
|
||||||
|
import backend_pb2_grpc
|
||||||
import argparse
|
import argparse
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from scipy.io.wavfile import write as write_wav
|
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
||||||
|
from pathlib import Path
|
||||||
import backend_pb2
|
|
||||||
import backend_pb2_grpc
|
|
||||||
from bark import SAMPLE_RATE, generate_audio, preload_models
|
from bark import SAMPLE_RATE, generate_audio, preload_models
|
||||||
|
from scipy.io.wavfile import write as write_wav
|
||||||
import grpc
|
|
||||||
|
|
||||||
|
|
||||||
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
||||||
|
|
||||||
@@ -25,9 +20,6 @@ MAX_WORKERS = int(os.environ.get('PYTHON_GRPC_MAX_WORKERS', '1'))
|
|||||||
|
|
||||||
# Implement the BackendServicer class with the service methods
|
# Implement the BackendServicer class with the service methods
|
||||||
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
||||||
"""
|
|
||||||
BackendServicer is the class that implements the gRPC service
|
|
||||||
"""
|
|
||||||
def Health(self, request, context):
|
def Health(self, request, context):
|
||||||
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
||||||
def LoadModel(self, request, context):
|
def LoadModel(self, request, context):
|
||||||
@@ -91,4 +83,4 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
serve(args.addr)
|
serve(args.addr)
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
name: bark
|
|
||||||
channels:
|
|
||||||
- defaults
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=main
|
|
||||||
- _openmp_mutex=5.1=1_gnu
|
|
||||||
- bzip2=1.0.8=h7b6447c_0
|
|
||||||
- ca-certificates=2023.08.22=h06a4308_0
|
|
||||||
- ld_impl_linux-64=2.38=h1181459_1
|
|
||||||
- libffi=3.4.4=h6a678d5_0
|
|
||||||
- libgcc-ng=11.2.0=h1234567_1
|
|
||||||
- libgomp=11.2.0=h1234567_1
|
|
||||||
- libstdcxx-ng=11.2.0=h1234567_1
|
|
||||||
- libuuid=1.41.5=h5eee18b_0
|
|
||||||
- ncurses=6.4=h6a678d5_0
|
|
||||||
- openssl=3.0.11=h7f8727e_2
|
|
||||||
- pip=23.2.1=py311h06a4308_0
|
|
||||||
- python=3.11.5=h955ad1f_0
|
|
||||||
- readline=8.2=h5eee18b_0
|
|
||||||
- setuptools=68.0.0=py311h06a4308_0
|
|
||||||
- sqlite=3.41.2=h5eee18b_0
|
|
||||||
- tk=8.6.12=h1ccaba5_0
|
|
||||||
- wheel=0.41.2=py311h06a4308_0
|
|
||||||
- xz=5.4.2=h5eee18b_0
|
|
||||||
- zlib=1.2.13=h5eee18b_0
|
|
||||||
- pip:
|
|
||||||
- accelerate==0.23.0
|
|
||||||
- aiohttp==3.8.5
|
|
||||||
- aiosignal==1.3.1
|
|
||||||
- async-timeout==4.0.3
|
|
||||||
- attrs==23.1.0
|
|
||||||
- bark==0.1.5
|
|
||||||
- boto3==1.28.61
|
|
||||||
- botocore==1.31.61
|
|
||||||
- certifi==2023.7.22
|
|
||||||
- charset-normalizer==3.3.0
|
|
||||||
- datasets==2.14.5
|
|
||||||
- dill==0.3.7
|
|
||||||
- einops==0.7.0
|
|
||||||
- encodec==0.1.1
|
|
||||||
- filelock==3.12.4
|
|
||||||
- frozenlist==1.4.0
|
|
||||||
- fsspec==2023.6.0
|
|
||||||
- funcy==2.0
|
|
||||||
- grpcio==1.59.0
|
|
||||||
- huggingface-hub==0.16.4
|
|
||||||
- idna==3.4
|
|
||||||
- jinja2==3.1.2
|
|
||||||
- jmespath==1.0.1
|
|
||||||
- markupsafe==2.1.3
|
|
||||||
- mpmath==1.3.0
|
|
||||||
- multidict==6.0.4
|
|
||||||
- multiprocess==0.70.15
|
|
||||||
- networkx==3.1
|
|
||||||
- numpy==1.26.0
|
|
||||||
- nvidia-cublas-cu12==12.1.3.1
|
|
||||||
- nvidia-cuda-cupti-cu12==12.1.105
|
|
||||||
- nvidia-cuda-nvrtc-cu12==12.1.105
|
|
||||||
- nvidia-cuda-runtime-cu12==12.1.105
|
|
||||||
- nvidia-cudnn-cu12==8.9.2.26
|
|
||||||
- nvidia-cufft-cu12==11.0.2.54
|
|
||||||
- nvidia-curand-cu12==10.3.2.106
|
|
||||||
- nvidia-cusolver-cu12==11.4.5.107
|
|
||||||
- nvidia-cusparse-cu12==12.1.0.106
|
|
||||||
- nvidia-nccl-cu12==2.18.1
|
|
||||||
- nvidia-nvjitlink-cu12==12.2.140
|
|
||||||
- nvidia-nvtx-cu12==12.1.105
|
|
||||||
- packaging==23.2
|
|
||||||
- pandas==2.1.1
|
|
||||||
- peft==0.5.0
|
|
||||||
- protobuf==4.24.4
|
|
||||||
- psutil==5.9.5
|
|
||||||
- pyarrow==13.0.0
|
|
||||||
- python-dateutil==2.8.2
|
|
||||||
- pytz==2023.3.post1
|
|
||||||
- pyyaml==6.0.1
|
|
||||||
- regex==2023.10.3
|
|
||||||
- requests==2.31.0
|
|
||||||
- rouge==1.0.1
|
|
||||||
- s3transfer==0.7.0
|
|
||||||
- safetensors==0.3.3
|
|
||||||
- scipy==1.11.3
|
|
||||||
- six==1.16.0
|
|
||||||
- sympy==1.12
|
|
||||||
- tokenizers==0.14.0
|
|
||||||
- torch==2.1.0
|
|
||||||
- torchaudio==2.1.0
|
|
||||||
- tqdm==4.66.1
|
|
||||||
- transformers==4.34.0
|
|
||||||
- triton==2.1.0
|
|
||||||
- typing-extensions==4.8.0
|
|
||||||
- tzdata==2023.3
|
|
||||||
- urllib3==1.26.17
|
|
||||||
- xxhash==3.4.1
|
|
||||||
- yarl==1.9.2
|
|
||||||
prefix: /opt/conda/envs/bark
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
.PONY: diffusers
|
|
||||||
diffusers:
|
|
||||||
@echo "Creating virtual environment..."
|
|
||||||
@conda env create --name diffusers --file diffusers.yml
|
|
||||||
@echo "Virtual environment created."
|
|
||||||
|
|
||||||
.PONY: run
|
|
||||||
run:
|
|
||||||
@echo "Running diffusers..."
|
|
||||||
bash run.sh
|
|
||||||
@echo "Diffusers run."
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Creating a separate environment for the diffusers project
|
|
||||||
|
|
||||||
```
|
|
||||||
make diffusers
|
|
||||||
```
|
|
||||||
@@ -1,32 +1,27 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import grpc
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
|
||||||
import argparse
|
|
||||||
from collections import defaultdict
|
|
||||||
from enum import Enum
|
|
||||||
import signal
|
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import os
|
|
||||||
|
|
||||||
from PIL import Image
|
|
||||||
import torch
|
|
||||||
|
|
||||||
import backend_pb2
|
import backend_pb2
|
||||||
import backend_pb2_grpc
|
import backend_pb2_grpc
|
||||||
|
import argparse
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
import grpc
|
# import diffusers
|
||||||
|
import torch
|
||||||
|
from torch import autocast
|
||||||
from diffusers import StableDiffusionXLPipeline, StableDiffusionDepth2ImgPipeline, DPMSolverMultistepScheduler, StableDiffusionPipeline, DiffusionPipeline, EulerAncestralDiscreteScheduler
|
from diffusers import StableDiffusionXLPipeline, StableDiffusionDepth2ImgPipeline, DPMSolverMultistepScheduler, StableDiffusionPipeline, DiffusionPipeline, EulerAncestralDiscreteScheduler
|
||||||
from diffusers import StableDiffusionImg2ImgPipeline
|
|
||||||
from diffusers.pipelines.stable_diffusion import safety_checker
|
from diffusers.pipelines.stable_diffusion import safety_checker
|
||||||
|
|
||||||
from compel import Compel
|
from compel import Compel
|
||||||
|
from PIL import Image
|
||||||
|
from io import BytesIO
|
||||||
|
from diffusers import StableDiffusionImg2ImgPipeline
|
||||||
from transformers import CLIPTextModel
|
from transformers import CLIPTextModel
|
||||||
|
from enum import Enum
|
||||||
|
from collections import defaultdict
|
||||||
from safetensors.torch import load_file
|
from safetensors.torch import load_file
|
||||||
|
|
||||||
|
|
||||||
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
||||||
COMPEL=os.environ.get("COMPEL", "1") == "1"
|
COMPEL=os.environ.get("COMPEL", "1") == "1"
|
||||||
CLIPSKIP=os.environ.get("CLIPSKIP", "1") == "1"
|
CLIPSKIP=os.environ.get("CLIPSKIP", "1") == "1"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,74 +0,0 @@
|
|||||||
name: diffusers
|
|
||||||
channels:
|
|
||||||
- defaults
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=main
|
|
||||||
- _openmp_mutex=5.1=1_gnu
|
|
||||||
- bzip2=1.0.8=h7b6447c_0
|
|
||||||
- ca-certificates=2023.08.22=h06a4308_0
|
|
||||||
- ld_impl_linux-64=2.38=h1181459_1
|
|
||||||
- libffi=3.4.4=h6a678d5_0
|
|
||||||
- libgcc-ng=11.2.0=h1234567_1
|
|
||||||
- libgomp=11.2.0=h1234567_1
|
|
||||||
- libstdcxx-ng=11.2.0=h1234567_1
|
|
||||||
- libuuid=1.41.5=h5eee18b_0
|
|
||||||
- ncurses=6.4=h6a678d5_0
|
|
||||||
- openssl=3.0.11=h7f8727e_2
|
|
||||||
- pip=23.2.1=py311h06a4308_0
|
|
||||||
- python=3.11.5=h955ad1f_0
|
|
||||||
- readline=8.2=h5eee18b_0
|
|
||||||
- setuptools=68.0.0=py311h06a4308_0
|
|
||||||
- sqlite=3.41.2=h5eee18b_0
|
|
||||||
- tk=8.6.12=h1ccaba5_0
|
|
||||||
- tzdata=2023c=h04d1e81_0
|
|
||||||
- wheel=0.41.2=py311h06a4308_0
|
|
||||||
- xz=5.4.2=h5eee18b_0
|
|
||||||
- zlib=1.2.13=h5eee18b_0
|
|
||||||
- pip:
|
|
||||||
- accelerate==0.23.0
|
|
||||||
- certifi==2023.7.22
|
|
||||||
- charset-normalizer==3.3.0
|
|
||||||
- compel==2.0.2
|
|
||||||
- diffusers==0.21.4
|
|
||||||
- filelock==3.12.4
|
|
||||||
- fsspec==2023.9.2
|
|
||||||
- grpcio==1.59.0
|
|
||||||
- huggingface-hub==0.17.3
|
|
||||||
- idna==3.4
|
|
||||||
- importlib-metadata==6.8.0
|
|
||||||
- jinja2==3.1.2
|
|
||||||
- markupsafe==2.1.3
|
|
||||||
- mpmath==1.3.0
|
|
||||||
- networkx==3.1
|
|
||||||
- numpy==1.26.0
|
|
||||||
- nvidia-cublas-cu12==12.1.3.1
|
|
||||||
- nvidia-cuda-cupti-cu12==12.1.105
|
|
||||||
- nvidia-cuda-nvrtc-cu12==12.1.105
|
|
||||||
- nvidia-cuda-runtime-cu12==12.1.105
|
|
||||||
- nvidia-cudnn-cu12==8.9.2.26
|
|
||||||
- nvidia-cufft-cu12==11.0.2.54
|
|
||||||
- nvidia-curand-cu12==10.3.2.106
|
|
||||||
- nvidia-cusolver-cu12==11.4.5.107
|
|
||||||
- nvidia-cusparse-cu12==12.1.0.106
|
|
||||||
- nvidia-nccl-cu12==2.18.1
|
|
||||||
- nvidia-nvjitlink-cu12==12.2.140
|
|
||||||
- nvidia-nvtx-cu12==12.1.105
|
|
||||||
- packaging==23.2
|
|
||||||
- pillow==10.0.1
|
|
||||||
- protobuf==4.24.4
|
|
||||||
- psutil==5.9.5
|
|
||||||
- pyparsing==3.1.1
|
|
||||||
- pyyaml==6.0.1
|
|
||||||
- regex==2023.10.3
|
|
||||||
- requests==2.31.0
|
|
||||||
- safetensors==0.4.0
|
|
||||||
- sympy==1.12
|
|
||||||
- tokenizers==0.14.1
|
|
||||||
- torch==2.1.0
|
|
||||||
- tqdm==4.66.1
|
|
||||||
- transformers==4.34.0
|
|
||||||
- triton==2.1.0
|
|
||||||
- typing-extensions==4.8.0
|
|
||||||
- urllib3==2.0.6
|
|
||||||
- zipp==3.17.0
|
|
||||||
prefix: /opt/conda/envs/diffusers
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the diffusers server with conda
|
|
||||||
|
|
||||||
export PATH=$PATH:/opt/conda/bin
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate diffusers
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python $DIR/backend_diffusers.py $@
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
.PONY: exllama
|
|
||||||
exllama:
|
|
||||||
@echo "Creating virtual environment..."
|
|
||||||
@conda env create --name exllama --file exllama.yml
|
|
||||||
@echo "Virtual environment created."
|
|
||||||
|
|
||||||
.PONY: run
|
|
||||||
run:
|
|
||||||
@echo "Running exllama..."
|
|
||||||
bash run.sh
|
|
||||||
@echo "exllama run."
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Creating a separate environment for the exllama project
|
|
||||||
|
|
||||||
```
|
|
||||||
make exllama
|
|
||||||
```
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,55 +0,0 @@
|
|||||||
name: exllama
|
|
||||||
channels:
|
|
||||||
- defaults
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=main
|
|
||||||
- _openmp_mutex=5.1=1_gnu
|
|
||||||
- bzip2=1.0.8=h7b6447c_0
|
|
||||||
- ca-certificates=2023.08.22=h06a4308_0
|
|
||||||
- ld_impl_linux-64=2.38=h1181459_1
|
|
||||||
- libffi=3.4.4=h6a678d5_0
|
|
||||||
- libgcc-ng=11.2.0=h1234567_1
|
|
||||||
- libgomp=11.2.0=h1234567_1
|
|
||||||
- libstdcxx-ng=11.2.0=h1234567_1
|
|
||||||
- libuuid=1.41.5=h5eee18b_0
|
|
||||||
- ncurses=6.4=h6a678d5_0
|
|
||||||
- openssl=3.0.11=h7f8727e_2
|
|
||||||
- pip=23.2.1=py311h06a4308_0
|
|
||||||
- python=3.11.5=h955ad1f_0
|
|
||||||
- readline=8.2=h5eee18b_0
|
|
||||||
- setuptools=68.0.0=py311h06a4308_0
|
|
||||||
- sqlite=3.41.2=h5eee18b_0
|
|
||||||
- tk=8.6.12=h1ccaba5_0
|
|
||||||
- tzdata=2023c=h04d1e81_0
|
|
||||||
- wheel=0.41.2=py311h06a4308_0
|
|
||||||
- xz=5.4.2=h5eee18b_0
|
|
||||||
- zlib=1.2.13=h5eee18b_0
|
|
||||||
- pip:
|
|
||||||
- filelock==3.12.4
|
|
||||||
- fsspec==2023.9.2
|
|
||||||
- grpcio==1.59.0
|
|
||||||
- jinja2==3.1.2
|
|
||||||
- markupsafe==2.1.3
|
|
||||||
- mpmath==1.3.0
|
|
||||||
- networkx==3.1
|
|
||||||
- ninja==1.11.1
|
|
||||||
- nvidia-cublas-cu12==12.1.3.1
|
|
||||||
- nvidia-cuda-cupti-cu12==12.1.105
|
|
||||||
- nvidia-cuda-nvrtc-cu12==12.1.105
|
|
||||||
- nvidia-cuda-runtime-cu12==12.1.105
|
|
||||||
- nvidia-cudnn-cu12==8.9.2.26
|
|
||||||
- nvidia-cufft-cu12==11.0.2.54
|
|
||||||
- nvidia-curand-cu12==10.3.2.106
|
|
||||||
- nvidia-cusolver-cu12==11.4.5.107
|
|
||||||
- nvidia-cusparse-cu12==12.1.0.106
|
|
||||||
- nvidia-nccl-cu12==2.18.1
|
|
||||||
- nvidia-nvjitlink-cu12==12.2.140
|
|
||||||
- nvidia-nvtx-cu12==12.1.105
|
|
||||||
- protobuf==4.24.4
|
|
||||||
- safetensors==0.3.2
|
|
||||||
- sentencepiece==0.1.99
|
|
||||||
- sympy==1.12
|
|
||||||
- torch==2.1.0
|
|
||||||
- triton==2.1.0
|
|
||||||
- typing-extensions==4.8.0
|
|
||||||
prefix: /opt/conda/envs/exllama
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the exllama server with conda
|
|
||||||
|
|
||||||
export PATH=$PATH:/opt/conda/bin
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate exllama
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python $DIR/exllama.py $@
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
.PONY: huggingface
|
|
||||||
huggingface:
|
|
||||||
@echo "Creating virtual environment..."
|
|
||||||
@conda env create --name huggingface --file huggingface.yml
|
|
||||||
@echo "Virtual environment created."
|
|
||||||
|
|
||||||
.PONY: run
|
|
||||||
run:
|
|
||||||
@echo "Running huggingface..."
|
|
||||||
bash run.sh
|
|
||||||
@echo "huggingface run."
|
|
||||||
|
|
||||||
# It is not working well by using command line. It only6 works with IDE like VSCode.
|
|
||||||
.PONY: test
|
|
||||||
test:
|
|
||||||
@echo "Testing huggingface..."
|
|
||||||
bash test.sh
|
|
||||||
@echo "huggingface tested."
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Creating a separate environment for the huggingface project
|
|
||||||
|
|
||||||
```
|
|
||||||
make huggingface
|
|
||||||
```
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,20 +1,13 @@
|
|||||||
"""
|
|
||||||
Extra gRPC server for HuggingFace SentenceTransformer models.
|
|
||||||
"""
|
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import grpc
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
import time
|
||||||
|
import backend_pb2
|
||||||
|
import backend_pb2_grpc
|
||||||
import argparse
|
import argparse
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import time
|
|
||||||
import backend_pb2
|
|
||||||
import backend_pb2_grpc
|
|
||||||
|
|
||||||
import grpc
|
|
||||||
|
|
||||||
from sentence_transformers import SentenceTransformer
|
from sentence_transformers import SentenceTransformer
|
||||||
|
|
||||||
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
||||||
@@ -24,56 +17,18 @@ MAX_WORKERS = int(os.environ.get('PYTHON_GRPC_MAX_WORKERS', '1'))
|
|||||||
|
|
||||||
# Implement the BackendServicer class with the service methods
|
# Implement the BackendServicer class with the service methods
|
||||||
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
||||||
"""
|
|
||||||
A gRPC servicer for the backend service.
|
|
||||||
|
|
||||||
This class implements the gRPC methods for the backend service, including Health, LoadModel, and Embedding.
|
|
||||||
"""
|
|
||||||
def Health(self, request, context):
|
def Health(self, request, context):
|
||||||
"""
|
|
||||||
A gRPC method that returns the health status of the backend service.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: A HealthRequest object that contains the request parameters.
|
|
||||||
context: A grpc.ServicerContext object that provides information about the RPC.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A Reply object that contains the health status of the backend service.
|
|
||||||
"""
|
|
||||||
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
||||||
|
|
||||||
def LoadModel(self, request, context):
|
def LoadModel(self, request, context):
|
||||||
"""
|
|
||||||
A gRPC method that loads a model into memory.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: A LoadModelRequest object that contains the request parameters.
|
|
||||||
context: A grpc.ServicerContext object that provides information about the RPC.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A Result object that contains the result of the LoadModel operation.
|
|
||||||
"""
|
|
||||||
model_name = request.Model
|
model_name = request.Model
|
||||||
try:
|
try:
|
||||||
self.model = SentenceTransformer(model_name)
|
self.model = SentenceTransformer(model_name)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
return backend_pb2.Result(success=False, message=f"Unexpected {err=}, {type(err)=}")
|
return backend_pb2.Result(success=False, message=f"Unexpected {err=}, {type(err)=}")
|
||||||
|
|
||||||
# Implement your logic here for the LoadModel service
|
# Implement your logic here for the LoadModel service
|
||||||
# Replace this with your desired response
|
# Replace this with your desired response
|
||||||
return backend_pb2.Result(message="Model loaded successfully", success=True)
|
return backend_pb2.Result(message="Model loaded successfully", success=True)
|
||||||
|
|
||||||
def Embedding(self, request, context):
|
def Embedding(self, request, context):
|
||||||
"""
|
|
||||||
A gRPC method that calculates embeddings for a given sentence.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: An EmbeddingRequest object that contains the request parameters.
|
|
||||||
context: A grpc.ServicerContext object that provides information about the RPC.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
An EmbeddingResult object that contains the calculated embeddings.
|
|
||||||
"""
|
|
||||||
# Implement your logic here for the Embedding service
|
# Implement your logic here for the Embedding service
|
||||||
# Replace this with your desired response
|
# Replace this with your desired response
|
||||||
print("Calculated embeddings for: " + request.Embeddings, file=sys.stderr)
|
print("Calculated embeddings for: " + request.Embeddings, file=sys.stderr)
|
||||||
@@ -111,4 +66,4 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
serve(args.addr)
|
serve(args.addr)
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
name: huggingface
|
|
||||||
channels:
|
|
||||||
- defaults
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=main
|
|
||||||
- _openmp_mutex=5.1=1_gnu
|
|
||||||
- bzip2=1.0.8=h7b6447c_0
|
|
||||||
- ca-certificates=2023.08.22=h06a4308_0
|
|
||||||
- ld_impl_linux-64=2.38=h1181459_1
|
|
||||||
- libffi=3.4.4=h6a678d5_0
|
|
||||||
- libgcc-ng=11.2.0=h1234567_1
|
|
||||||
- libgomp=11.2.0=h1234567_1
|
|
||||||
- libstdcxx-ng=11.2.0=h1234567_1
|
|
||||||
- libuuid=1.41.5=h5eee18b_0
|
|
||||||
- ncurses=6.4=h6a678d5_0
|
|
||||||
- openssl=3.0.11=h7f8727e_2
|
|
||||||
- pip=23.2.1=py311h06a4308_0
|
|
||||||
- python=3.11.5=h955ad1f_0
|
|
||||||
- readline=8.2=h5eee18b_0
|
|
||||||
- setuptools=68.0.0=py311h06a4308_0
|
|
||||||
- sqlite=3.41.2=h5eee18b_0
|
|
||||||
- tk=8.6.12=h1ccaba5_0
|
|
||||||
- tzdata=2023c=h04d1e81_0
|
|
||||||
- wheel=0.41.2=py311h06a4308_0
|
|
||||||
- xz=5.4.2=h5eee18b_0
|
|
||||||
- zlib=1.2.13=h5eee18b_0
|
|
||||||
- pip:
|
|
||||||
- certifi==2023.7.22
|
|
||||||
- charset-normalizer==3.3.0
|
|
||||||
- click==8.1.7
|
|
||||||
- filelock==3.12.4
|
|
||||||
- fsspec==2023.9.2
|
|
||||||
- grpcio==1.59.0
|
|
||||||
- huggingface-hub==0.17.3
|
|
||||||
- idna==3.4
|
|
||||||
- install==1.3.5
|
|
||||||
- jinja2==3.1.2
|
|
||||||
- joblib==1.3.2
|
|
||||||
- markupsafe==2.1.3
|
|
||||||
- mpmath==1.3.0
|
|
||||||
- networkx==3.1
|
|
||||||
- nltk==3.8.1
|
|
||||||
- numpy==1.26.0
|
|
||||||
- nvidia-cublas-cu12==12.1.3.1
|
|
||||||
- nvidia-cuda-cupti-cu12==12.1.105
|
|
||||||
- nvidia-cuda-nvrtc-cu12==12.1.105
|
|
||||||
- nvidia-cuda-runtime-cu12==12.1.105
|
|
||||||
- nvidia-cudnn-cu12==8.9.2.26
|
|
||||||
- nvidia-cufft-cu12==11.0.2.54
|
|
||||||
- nvidia-curand-cu12==10.3.2.106
|
|
||||||
- nvidia-cusolver-cu12==11.4.5.107
|
|
||||||
- nvidia-cusparse-cu12==12.1.0.106
|
|
||||||
- nvidia-nccl-cu12==2.18.1
|
|
||||||
- nvidia-nvjitlink-cu12==12.2.140
|
|
||||||
- nvidia-nvtx-cu12==12.1.105
|
|
||||||
- packaging==23.2
|
|
||||||
- pillow==10.0.1
|
|
||||||
- protobuf==4.24.4
|
|
||||||
- pyyaml==6.0.1
|
|
||||||
- regex==2023.10.3
|
|
||||||
- requests==2.31.0
|
|
||||||
- safetensors==0.4.0
|
|
||||||
- scikit-learn==1.3.1
|
|
||||||
- scipy==1.11.3
|
|
||||||
- sentence-transformers==2.2.2
|
|
||||||
- sentencepiece==0.1.99
|
|
||||||
- sympy==1.12
|
|
||||||
- threadpoolctl==3.2.0
|
|
||||||
- tokenizers==0.14.1
|
|
||||||
- torch==2.1.0
|
|
||||||
- torchvision==0.16.0
|
|
||||||
- tqdm==4.66.1
|
|
||||||
- transformers==4.34.0
|
|
||||||
- triton==2.1.0
|
|
||||||
- typing-extensions==4.8.0
|
|
||||||
- urllib3==2.0.6
|
|
||||||
prefix: /opt/conda/envs/huggingface
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the huggingface server with conda
|
|
||||||
|
|
||||||
export PATH=$PATH:/opt/conda/bin
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate huggingface
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python $DIR/huggingface.py $@
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the huggingface server with conda
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate huggingface
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python -m unittest $DIR/test_huggingface.py
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
"""
|
|
||||||
A test script to test the gRPC service
|
|
||||||
"""
|
|
||||||
import unittest
|
|
||||||
import subprocess
|
|
||||||
import time
|
|
||||||
import backend_pb2
|
|
||||||
import backend_pb2_grpc
|
|
||||||
|
|
||||||
import grpc
|
|
||||||
|
|
||||||
|
|
||||||
class TestBackendServicer(unittest.TestCase):
|
|
||||||
"""
|
|
||||||
TestBackendServicer is the class that tests the gRPC service
|
|
||||||
"""
|
|
||||||
def setUp(self):
|
|
||||||
"""
|
|
||||||
This method sets up the gRPC service by starting the server
|
|
||||||
"""
|
|
||||||
self.service = subprocess.Popen(["python3", "huggingface.py", "--addr", "localhost:50051"])
|
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
|
||||||
"""
|
|
||||||
This method tears down the gRPC service by terminating the server
|
|
||||||
"""
|
|
||||||
self.service.terminate()
|
|
||||||
self.service.wait()
|
|
||||||
|
|
||||||
def test_server_startup(self):
|
|
||||||
"""
|
|
||||||
This method tests if the server starts up successfully
|
|
||||||
"""
|
|
||||||
time.sleep(2)
|
|
||||||
try:
|
|
||||||
self.setUp()
|
|
||||||
with grpc.insecure_channel("localhost:50051") as channel:
|
|
||||||
stub = backend_pb2_grpc.BackendStub(channel)
|
|
||||||
response = stub.Health(backend_pb2.HealthMessage())
|
|
||||||
self.assertEqual(response.message, b'OK')
|
|
||||||
except Exception as err:
|
|
||||||
print(err)
|
|
||||||
self.fail("Server failed to start")
|
|
||||||
finally:
|
|
||||||
self.tearDown()
|
|
||||||
|
|
||||||
def test_load_model(self):
|
|
||||||
"""
|
|
||||||
This method tests if the model is loaded successfully
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
self.setUp()
|
|
||||||
with grpc.insecure_channel("localhost:50051") as channel:
|
|
||||||
stub = backend_pb2_grpc.BackendStub(channel)
|
|
||||||
response = stub.LoadModel(backend_pb2.ModelOptions(Model="bert-base-nli-mean-tokens"))
|
|
||||||
self.assertTrue(response.success)
|
|
||||||
self.assertEqual(response.message, "Model loaded successfully")
|
|
||||||
except Exception as err:
|
|
||||||
print(err)
|
|
||||||
self.fail("LoadModel service failed")
|
|
||||||
finally:
|
|
||||||
self.tearDown()
|
|
||||||
|
|
||||||
def test_embedding(self):
|
|
||||||
"""
|
|
||||||
This method tests if the embeddings are generated successfully
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
self.setUp()
|
|
||||||
with grpc.insecure_channel("localhost:50051") as channel:
|
|
||||||
stub = backend_pb2_grpc.BackendStub(channel)
|
|
||||||
response = stub.LoadModel(backend_pb2.ModelOptions(Model="bert-base-nli-mean-tokens"))
|
|
||||||
self.assertTrue(response.success)
|
|
||||||
embedding_request = backend_pb2.PredictOptions(Embeddings="This is a test sentence.")
|
|
||||||
embedding_response = stub.Embedding(embedding_request)
|
|
||||||
self.assertIsNotNone(embedding_response.embeddings)
|
|
||||||
except Exception as err:
|
|
||||||
print(err)
|
|
||||||
self.fail("Embedding service failed")
|
|
||||||
finally:
|
|
||||||
self.tearDown()
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
.PONY: ttsvalle
|
|
||||||
ttsvalle:
|
|
||||||
@echo "Creating virtual environment..."
|
|
||||||
@conda env create --name ttsvalle --file ttsvalle.yml
|
|
||||||
@echo "Virtual environment created."
|
|
||||||
|
|
||||||
.PONY: run
|
|
||||||
run:
|
|
||||||
@echo "Running ttsvalle..."
|
|
||||||
bash run.sh
|
|
||||||
@echo "ttsvalle run."
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Creating a separate environment for the ttsvalle project
|
|
||||||
|
|
||||||
```
|
|
||||||
make ttsvalle
|
|
||||||
```
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the ttsvalle server with conda
|
|
||||||
export PATH=$PATH:/opt/conda/bin
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate ttsvalle
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python $DIR/ttvalle.py $@
|
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import grpc
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
import time
|
||||||
|
import backend_pb2
|
||||||
|
import backend_pb2_grpc
|
||||||
import argparse
|
import argparse
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import time
|
from pathlib import Path
|
||||||
import backend_pb2
|
|
||||||
import backend_pb2_grpc
|
|
||||||
|
|
||||||
import grpc
|
|
||||||
|
|
||||||
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
|
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
|
||||||
from scipy.io.wavfile import write as write_wav
|
from scipy.io.wavfile import write as write_wav
|
||||||
@@ -22,34 +21,9 @@ MAX_WORKERS = int(os.environ.get('PYTHON_GRPC_MAX_WORKERS', '1'))
|
|||||||
|
|
||||||
# Implement the BackendServicer class with the service methods
|
# Implement the BackendServicer class with the service methods
|
||||||
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
||||||
"""
|
|
||||||
gRPC servicer for backend services.
|
|
||||||
"""
|
|
||||||
def Health(self, request, context):
|
def Health(self, request, context):
|
||||||
"""
|
|
||||||
Health check service.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: A backend_pb2.HealthRequest instance.
|
|
||||||
context: A grpc.ServicerContext instance.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A backend_pb2.Reply instance with message "OK".
|
|
||||||
"""
|
|
||||||
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
||||||
|
|
||||||
def LoadModel(self, request, context):
|
def LoadModel(self, request, context):
|
||||||
"""
|
|
||||||
Load model service.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: A backend_pb2.LoadModelRequest instance.
|
|
||||||
context: A grpc.ServicerContext instance.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A backend_pb2.Result instance with message "Model loaded successfully" and success=True if successful.
|
|
||||||
A backend_pb2.Result instance with success=False and error message if unsuccessful.
|
|
||||||
"""
|
|
||||||
model_name = request.Model
|
model_name = request.Model
|
||||||
try:
|
try:
|
||||||
print("Preparing models, please wait", file=sys.stderr)
|
print("Preparing models, please wait", file=sys.stderr)
|
||||||
@@ -75,17 +49,6 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||||||
return backend_pb2.Result(message="Model loaded successfully", success=True)
|
return backend_pb2.Result(message="Model loaded successfully", success=True)
|
||||||
|
|
||||||
def TTS(self, request, context):
|
def TTS(self, request, context):
|
||||||
"""
|
|
||||||
Text-to-speech service.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: A backend_pb2.TTSRequest instance.
|
|
||||||
context: A grpc.ServicerContext instance.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A backend_pb2.Result instance with success=True if successful.
|
|
||||||
A backend_pb2.Result instance with success=False and error message if unsuccessful.
|
|
||||||
"""
|
|
||||||
model = request.model
|
model = request.model
|
||||||
print(request, file=sys.stderr)
|
print(request, file=sys.stderr)
|
||||||
try:
|
try:
|
||||||
@@ -134,4 +97,4 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
serve(args.addr)
|
serve(args.addr)
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
name: ttsvalle
|
|
||||||
channels:
|
|
||||||
- defaults
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=main
|
|
||||||
- _openmp_mutex=5.1=1_gnu
|
|
||||||
- bzip2=1.0.8=h7b6447c_0
|
|
||||||
- ca-certificates=2023.08.22=h06a4308_0
|
|
||||||
- ld_impl_linux-64=2.38=h1181459_1
|
|
||||||
- libffi=3.4.4=h6a678d5_0
|
|
||||||
- libgcc-ng=11.2.0=h1234567_1
|
|
||||||
- libgomp=11.2.0=h1234567_1
|
|
||||||
- libstdcxx-ng=11.2.0=h1234567_1
|
|
||||||
- libuuid=1.41.5=h5eee18b_0
|
|
||||||
- ncurses=6.4=h6a678d5_0
|
|
||||||
- openssl=3.0.11=h7f8727e_2
|
|
||||||
- pip=23.2.1=py310h06a4308_0
|
|
||||||
- python=3.10.13=h955ad1f_0
|
|
||||||
- readline=8.2=h5eee18b_0
|
|
||||||
- setuptools=68.0.0=py310h06a4308_0
|
|
||||||
- sqlite=3.41.2=h5eee18b_0
|
|
||||||
- tk=8.6.12=h1ccaba5_0
|
|
||||||
- tzdata=2023c=h04d1e81_0
|
|
||||||
- wheel=0.41.2=py310h06a4308_0
|
|
||||||
- xz=5.4.2=h5eee18b_0
|
|
||||||
- zlib=1.2.13=h5eee18b_0
|
|
||||||
- pip:
|
|
||||||
- aiofiles==23.2.1
|
|
||||||
- altair==5.1.2
|
|
||||||
- annotated-types==0.6.0
|
|
||||||
- anyio==3.7.1
|
|
||||||
- click==8.1.7
|
|
||||||
- cn2an==0.5.22
|
|
||||||
- cython==3.0.3
|
|
||||||
- einops==0.7.0
|
|
||||||
- encodec==0.1.1
|
|
||||||
- eng-to-ipa==0.0.2
|
|
||||||
- fastapi==0.103.2
|
|
||||||
- ffmpeg-python==0.2.0
|
|
||||||
- ffmpy==0.3.1
|
|
||||||
- fsspec==2023.9.2
|
|
||||||
- future==0.18.3
|
|
||||||
- gradio==3.47.1
|
|
||||||
- gradio-client==0.6.0
|
|
||||||
- grpcio==1.59.0
|
|
||||||
- h11==0.14.0
|
|
||||||
- httpcore==0.18.0
|
|
||||||
- httpx==0.25.0
|
|
||||||
- huggingface-hub==0.17.3
|
|
||||||
- importlib-resources==6.1.0
|
|
||||||
- inflect==7.0.0
|
|
||||||
- jieba==0.42.1
|
|
||||||
- langid==1.1.6
|
|
||||||
- llvmlite==0.41.0
|
|
||||||
- more-itertools==10.1.0
|
|
||||||
- nltk==3.8.1
|
|
||||||
- numba==0.58.0
|
|
||||||
- numpy==1.25.2
|
|
||||||
- nvidia-cublas-cu12==12.1.3.1
|
|
||||||
- nvidia-cuda-cupti-cu12==12.1.105
|
|
||||||
- nvidia-cuda-nvrtc-cu12==12.1.105
|
|
||||||
- nvidia-cuda-runtime-cu12==12.1.105
|
|
||||||
- nvidia-cudnn-cu12==8.9.2.26
|
|
||||||
- nvidia-cufft-cu12==11.0.2.54
|
|
||||||
- nvidia-curand-cu12==10.3.2.106
|
|
||||||
- nvidia-cusolver-cu12==11.4.5.107
|
|
||||||
- nvidia-cusparse-cu12==12.1.0.106
|
|
||||||
- nvidia-nccl-cu12==2.18.1
|
|
||||||
- nvidia-nvjitlink-cu12==12.2.140
|
|
||||||
- nvidia-nvtx-cu12==12.1.105
|
|
||||||
- openai-whisper==20230306
|
|
||||||
- orjson==3.9.7
|
|
||||||
- proces==0.1.7
|
|
||||||
- protobuf==4.24.4
|
|
||||||
- pydantic==2.4.2
|
|
||||||
- pydantic-core==2.10.1
|
|
||||||
- pydub==0.25.1
|
|
||||||
- pyopenjtalk-prebuilt==0.3.0
|
|
||||||
- pypinyin==0.49.0
|
|
||||||
- python-multipart==0.0.6
|
|
||||||
- regex==2023.10.3
|
|
||||||
- safetensors==0.4.0
|
|
||||||
- semantic-version==2.10.0
|
|
||||||
- soundfile==0.12.1
|
|
||||||
- starlette==0.27.0
|
|
||||||
- sudachidict-core==20230927
|
|
||||||
- sudachipy==0.6.7
|
|
||||||
- tokenizers==0.14.1
|
|
||||||
- toolz==0.12.0
|
|
||||||
- torch==2.1.0
|
|
||||||
- torchaudio==2.1.0
|
|
||||||
- torchvision==0.16.0
|
|
||||||
- tqdm==4.66.1
|
|
||||||
- transformers==4.34.0
|
|
||||||
- triton==2.1.0
|
|
||||||
- unidecode==1.3.7
|
|
||||||
- uvicorn==0.23.2
|
|
||||||
- vocos==0.0.3
|
|
||||||
- websockets==11.0.3
|
|
||||||
- wget==3.2
|
|
||||||
prefix: /opt/conda/envs/ttsvalle
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
.PONY: vllm
|
|
||||||
vllm:
|
|
||||||
@echo "Creating virtual environment..."
|
|
||||||
@conda env create --name vllm --file vllm.yml
|
|
||||||
@echo "Virtual environment created."
|
|
||||||
|
|
||||||
.PONY: run
|
|
||||||
run:
|
|
||||||
@echo "Running vllm..."
|
|
||||||
bash run.sh
|
|
||||||
@echo "vllm run."
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Creating a separate environment for the vllm project
|
|
||||||
|
|
||||||
```
|
|
||||||
make vllm
|
|
||||||
```
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import grpc
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
import time
|
import time
|
||||||
|
import backend_pb2
|
||||||
|
import backend_pb2_grpc
|
||||||
import argparse
|
import argparse
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os, glob
|
||||||
|
|
||||||
import backend_pb2
|
from pathlib import Path
|
||||||
import backend_pb2_grpc
|
|
||||||
|
|
||||||
import grpc
|
|
||||||
from vllm import LLM, SamplingParams
|
from vllm import LLM, SamplingParams
|
||||||
|
|
||||||
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
||||||
@@ -19,20 +19,7 @@ MAX_WORKERS = int(os.environ.get('PYTHON_GRPC_MAX_WORKERS', '1'))
|
|||||||
|
|
||||||
# Implement the BackendServicer class with the service methods
|
# Implement the BackendServicer class with the service methods
|
||||||
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
class BackendServicer(backend_pb2_grpc.BackendServicer):
|
||||||
"""
|
|
||||||
A gRPC servicer that implements the Backend service defined in backend.proto.
|
|
||||||
"""
|
|
||||||
def generate(self,prompt, max_new_tokens):
|
def generate(self,prompt, max_new_tokens):
|
||||||
"""
|
|
||||||
Generates text based on the given prompt and maximum number of new tokens.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
prompt (str): The prompt to generate text from.
|
|
||||||
max_new_tokens (int): The maximum number of new tokens to generate.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: The generated text.
|
|
||||||
"""
|
|
||||||
self.generator.end_beam_search()
|
self.generator.end_beam_search()
|
||||||
|
|
||||||
# Tokenizing the input
|
# Tokenizing the input
|
||||||
@@ -54,31 +41,9 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||||||
if token.item() == self.generator.tokenizer.eos_token_id:
|
if token.item() == self.generator.tokenizer.eos_token_id:
|
||||||
break
|
break
|
||||||
return decoded_text
|
return decoded_text
|
||||||
|
|
||||||
def Health(self, request, context):
|
def Health(self, request, context):
|
||||||
"""
|
|
||||||
Returns a health check message.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: The health check request.
|
|
||||||
context: The gRPC context.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
backend_pb2.Reply: The health check reply.
|
|
||||||
"""
|
|
||||||
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
return backend_pb2.Reply(message=bytes("OK", 'utf-8'))
|
||||||
|
|
||||||
def LoadModel(self, request, context):
|
def LoadModel(self, request, context):
|
||||||
"""
|
|
||||||
Loads a language model.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: The load model request.
|
|
||||||
context: The gRPC context.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
backend_pb2.Result: The load model result.
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
if request.Quantization != "":
|
if request.Quantization != "":
|
||||||
self.llm = LLM(model=request.Model, quantization=request.Quantization)
|
self.llm = LLM(model=request.Model, quantization=request.Quantization)
|
||||||
@@ -89,16 +54,6 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||||||
return backend_pb2.Result(message="Model loaded successfully", success=True)
|
return backend_pb2.Result(message="Model loaded successfully", success=True)
|
||||||
|
|
||||||
def Predict(self, request, context):
|
def Predict(self, request, context):
|
||||||
"""
|
|
||||||
Generates text based on the given prompt and sampling parameters.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: The predict request.
|
|
||||||
context: The gRPC context.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
backend_pb2.Result: The predict result.
|
|
||||||
"""
|
|
||||||
if request.TopP == 0:
|
if request.TopP == 0:
|
||||||
request.TopP = 0.9
|
request.TopP = 0.9
|
||||||
|
|
||||||
@@ -113,16 +68,6 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||||||
return backend_pb2.Result(message=bytes(generated_text, encoding='utf-8'))
|
return backend_pb2.Result(message=bytes(generated_text, encoding='utf-8'))
|
||||||
|
|
||||||
def PredictStream(self, request, context):
|
def PredictStream(self, request, context):
|
||||||
"""
|
|
||||||
Generates text based on the given prompt and sampling parameters, and streams the results.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request: The predict stream request.
|
|
||||||
context: The gRPC context.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
backend_pb2.Result: The predict stream result.
|
|
||||||
"""
|
|
||||||
# Implement PredictStream RPC
|
# Implement PredictStream RPC
|
||||||
#for reply in some_data_generator():
|
#for reply in some_data_generator():
|
||||||
# yield reply
|
# yield reply
|
||||||
@@ -159,4 +104,4 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
serve(args.addr)
|
serve(args.addr)
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
##
|
|
||||||
## A bash script wrapper that runs the diffusers server with conda
|
|
||||||
|
|
||||||
export PATH=$PATH:/opt/conda/bin
|
|
||||||
|
|
||||||
# Activate conda environment
|
|
||||||
source activate vllm
|
|
||||||
|
|
||||||
# get the directory where the bash script is located
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
|
|
||||||
python $DIR/backend_vllm.py $@
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import unittest
|
|
||||||
import subprocess
|
|
||||||
import time
|
|
||||||
import backend_pb2
|
|
||||||
import backend_pb2_grpc
|
|
||||||
|
|
||||||
import grpc
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
import subprocess
|
|
||||||
import time
|
|
||||||
import grpc
|
|
||||||
import backend_pb2_grpc
|
|
||||||
import backend_pb2
|
|
||||||
|
|
||||||
class TestBackendServicer(unittest.TestCase):
|
|
||||||
"""
|
|
||||||
TestBackendServicer is the class that tests the gRPC service.
|
|
||||||
|
|
||||||
This class contains methods to test the startup and shutdown of the gRPC service.
|
|
||||||
"""
|
|
||||||
def setUp(self):
|
|
||||||
self.service = subprocess.Popen(["python", "backend_vllm.py", "--addr", "localhost:50051"])
|
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
|
||||||
self.service.terminate()
|
|
||||||
self.service.wait()
|
|
||||||
|
|
||||||
def test_server_startup(self):
|
|
||||||
time.sleep(2)
|
|
||||||
try:
|
|
||||||
self.setUp()
|
|
||||||
with grpc.insecure_channel("localhost:50051") as channel:
|
|
||||||
stub = backend_pb2_grpc.BackendStub(channel)
|
|
||||||
response = stub.Health(backend_pb2.HealthMessage())
|
|
||||||
self.assertEqual(response.message, b'OK')
|
|
||||||
except Exception as err:
|
|
||||||
print(err)
|
|
||||||
self.fail("Server failed to start")
|
|
||||||
finally:
|
|
||||||
self.tearDown()
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
name: vllm
|
|
||||||
channels:
|
|
||||||
- defaults
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=main
|
|
||||||
- _openmp_mutex=5.1=1_gnu
|
|
||||||
- bzip2=1.0.8=h7b6447c_0
|
|
||||||
- ca-certificates=2023.08.22=h06a4308_0
|
|
||||||
- ld_impl_linux-64=2.38=h1181459_1
|
|
||||||
- libffi=3.4.4=h6a678d5_0
|
|
||||||
- libgcc-ng=11.2.0=h1234567_1
|
|
||||||
- libgomp=11.2.0=h1234567_1
|
|
||||||
- libstdcxx-ng=11.2.0=h1234567_1
|
|
||||||
- libuuid=1.41.5=h5eee18b_0
|
|
||||||
- ncurses=6.4=h6a678d5_0
|
|
||||||
- openssl=3.0.11=h7f8727e_2
|
|
||||||
- pip=23.2.1=py311h06a4308_0
|
|
||||||
- python=3.11.5=h955ad1f_0
|
|
||||||
- readline=8.2=h5eee18b_0
|
|
||||||
- setuptools=68.0.0=py311h06a4308_0
|
|
||||||
- sqlite=3.41.2=h5eee18b_0
|
|
||||||
- tk=8.6.12=h1ccaba5_0
|
|
||||||
- wheel=0.41.2=py311h06a4308_0
|
|
||||||
- xz=5.4.2=h5eee18b_0
|
|
||||||
- zlib=1.2.13=h5eee18b_0
|
|
||||||
- pip:
|
|
||||||
- aiosignal==1.3.1
|
|
||||||
- anyio==3.7.1
|
|
||||||
- attrs==23.1.0
|
|
||||||
- certifi==2023.7.22
|
|
||||||
- charset-normalizer==3.3.0
|
|
||||||
- click==8.1.7
|
|
||||||
- cmake==3.27.6
|
|
||||||
- fastapi==0.103.2
|
|
||||||
- filelock==3.12.4
|
|
||||||
- frozenlist==1.4.0
|
|
||||||
- fsspec==2023.9.2
|
|
||||||
- grpcio==1.59.0
|
|
||||||
- h11==0.14.0
|
|
||||||
- httptools==0.6.0
|
|
||||||
- huggingface-hub==0.17.3
|
|
||||||
- idna==3.4
|
|
||||||
- jinja2==3.1.2
|
|
||||||
- jsonschema==4.19.1
|
|
||||||
- jsonschema-specifications==2023.7.1
|
|
||||||
- lit==17.0.2
|
|
||||||
- markupsafe==2.1.3
|
|
||||||
- mpmath==1.3.0
|
|
||||||
- msgpack==1.0.7
|
|
||||||
- networkx==3.1
|
|
||||||
- ninja==1.11.1
|
|
||||||
- numpy==1.26.0
|
|
||||||
- nvidia-cublas-cu11==11.10.3.66
|
|
||||||
- nvidia-cuda-cupti-cu11==11.7.101
|
|
||||||
- nvidia-cuda-nvrtc-cu11==11.7.99
|
|
||||||
- nvidia-cuda-runtime-cu11==11.7.99
|
|
||||||
- nvidia-cudnn-cu11==8.5.0.96
|
|
||||||
- nvidia-cufft-cu11==10.9.0.58
|
|
||||||
- nvidia-curand-cu11==10.2.10.91
|
|
||||||
- nvidia-cusolver-cu11==11.4.0.1
|
|
||||||
- nvidia-cusparse-cu11==11.7.4.91
|
|
||||||
- nvidia-nccl-cu11==2.14.3
|
|
||||||
- nvidia-nvtx-cu11==11.7.91
|
|
||||||
- packaging==23.2
|
|
||||||
- pandas==2.1.1
|
|
||||||
- protobuf==4.24.4
|
|
||||||
- psutil==5.9.5
|
|
||||||
- pyarrow==13.0.0
|
|
||||||
- pydantic==1.10.13
|
|
||||||
- python-dateutil==2.8.2
|
|
||||||
- python-dotenv==1.0.0
|
|
||||||
- pytz==2023.3.post1
|
|
||||||
- pyyaml==6.0.1
|
|
||||||
- ray==2.7.0
|
|
||||||
- referencing==0.30.2
|
|
||||||
- regex==2023.10.3
|
|
||||||
- requests==2.31.0
|
|
||||||
- rpds-py==0.10.4
|
|
||||||
- safetensors==0.4.0
|
|
||||||
- sentencepiece==0.1.99
|
|
||||||
- six==1.16.0
|
|
||||||
- sniffio==1.3.0
|
|
||||||
- starlette==0.27.0
|
|
||||||
- sympy==1.12
|
|
||||||
- tokenizers==0.14.1
|
|
||||||
- torch==2.0.1
|
|
||||||
- tqdm==4.66.1
|
|
||||||
- transformers==4.34.0
|
|
||||||
- triton==2.0.0
|
|
||||||
- typing-extensions==4.8.0
|
|
||||||
- tzdata==2023.3
|
|
||||||
- urllib3==2.0.6
|
|
||||||
- uvicorn==0.23.2
|
|
||||||
- uvloop==0.17.0
|
|
||||||
- vllm==0.2.0
|
|
||||||
- watchfiles==0.20.0
|
|
||||||
- websockets==11.0.3
|
|
||||||
- xformers==0.0.22
|
|
||||||
prefix: /opt/conda/envs/vllm
|
|
||||||
42
go.mod
42
go.mod
@@ -4,13 +4,13 @@ go 1.21
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/donomii/go-rwkv.cpp v0.0.0-20230715075832-c898cd0f62df
|
github.com/donomii/go-rwkv.cpp v0.0.0-20230715075832-c898cd0f62df
|
||||||
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230628193450-85ed71aaec8e
|
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20231015123506-54c978c3a31d
|
||||||
github.com/go-audio/wav v1.1.0
|
github.com/go-audio/wav v1.1.0
|
||||||
github.com/go-skynet/bloomz.cpp v0.0.0-20230529155654-1834e77b83fa
|
github.com/go-skynet/bloomz.cpp v0.0.0-20230529155654-1834e77b83fa
|
||||||
github.com/go-skynet/go-bert.cpp v0.0.0-20230716133540-6abe312cded1
|
github.com/go-skynet/go-bert.cpp v0.0.0-20230716133540-6abe312cded1
|
||||||
github.com/go-skynet/go-ggml-transformers.cpp v0.0.0-20230714203132-ffb09d7dd71e
|
github.com/go-skynet/go-ggml-transformers.cpp v0.0.0-20230714203132-ffb09d7dd71e
|
||||||
github.com/go-skynet/go-llama.cpp v0.0.0-20231009155254-aeba71ee8428
|
github.com/go-skynet/go-llama.cpp v0.0.0-20231009155254-aeba71ee8428
|
||||||
github.com/gofiber/fiber/v2 v2.50.0
|
github.com/gofiber/fiber/v2 v2.49.2
|
||||||
github.com/google/uuid v1.3.1
|
github.com/google/uuid v1.3.1
|
||||||
github.com/hashicorp/go-multierror v1.1.1
|
github.com/hashicorp/go-multierror v1.1.1
|
||||||
github.com/hpcloud/tail v1.0.0
|
github.com/hpcloud/tail v1.0.0
|
||||||
@@ -20,23 +20,18 @@ require (
|
|||||||
github.com/mudler/go-ggllm.cpp v0.0.0-20230709223052-862477d16eef
|
github.com/mudler/go-ggllm.cpp v0.0.0-20230709223052-862477d16eef
|
||||||
github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c
|
github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c
|
||||||
github.com/mudler/go-stable-diffusion v0.0.0-20230605122230-d89260f598af
|
github.com/mudler/go-stable-diffusion v0.0.0-20230605122230-d89260f598af
|
||||||
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231022042237-c25dc5193530
|
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231013181651-22de3c56bdd4
|
||||||
github.com/onsi/ginkgo/v2 v2.13.0
|
github.com/onsi/ginkgo/v2 v2.13.0
|
||||||
github.com/onsi/gomega v1.28.1
|
github.com/onsi/gomega v1.28.0
|
||||||
github.com/otiai10/openaigo v1.6.0
|
github.com/otiai10/openaigo v1.6.0
|
||||||
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
|
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
|
||||||
github.com/prometheus/client_golang v1.17.0
|
|
||||||
github.com/rs/zerolog v1.31.0
|
github.com/rs/zerolog v1.31.0
|
||||||
github.com/sashabaranov/go-openai v1.16.0
|
github.com/sashabaranov/go-openai v1.16.0
|
||||||
github.com/schollz/progressbar/v3 v3.13.1
|
github.com/schollz/progressbar/v3 v3.13.1
|
||||||
github.com/tmc/langchaingo v0.0.0-20231019140956-c636b3da7701
|
github.com/tmc/langchaingo v0.0.0-20230929160525-e16b77704b8d
|
||||||
github.com/urfave/cli/v2 v2.25.7
|
github.com/urfave/cli/v2 v2.25.7
|
||||||
github.com/valyala/fasthttp v1.50.0
|
github.com/valyala/fasthttp v1.50.0
|
||||||
go.opentelemetry.io/otel v1.19.0
|
google.golang.org/grpc v1.58.3
|
||||||
go.opentelemetry.io/otel/exporters/prometheus v0.42.0
|
|
||||||
go.opentelemetry.io/otel/metric v1.19.0
|
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.19.0
|
|
||||||
google.golang.org/grpc v1.59.0
|
|
||||||
google.golang.org/protobuf v1.31.0
|
google.golang.org/protobuf v1.31.0
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
@@ -54,30 +49,23 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
|
||||||
github.com/dlclark/regexp2 v1.8.1 // indirect
|
github.com/dlclark/regexp2 v1.8.1 // indirect
|
||||||
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
|
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
github.com/golang/snappy v0.0.2 // indirect
|
github.com/golang/snappy v0.0.2 // indirect
|
||||||
github.com/klauspost/pgzip v1.2.5 // indirect
|
github.com/klauspost/pgzip v1.2.5 // indirect
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/nwaples/rardecode v1.1.0 // indirect
|
github.com/nwaples/rardecode v1.1.0 // indirect
|
||||||
github.com/pierrec/lz4/v4 v4.1.2 // indirect
|
github.com/pierrec/lz4/v4 v4.1.2 // indirect
|
||||||
github.com/pkoukk/tiktoken-go v0.1.2 // indirect
|
github.com/pkoukk/tiktoken-go v0.1.2 // indirect
|
||||||
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
|
|
||||||
github.com/prometheus/common v0.44.0 // indirect
|
|
||||||
github.com/prometheus/procfs v0.11.1 // indirect
|
|
||||||
github.com/ulikunitz/xz v0.5.9 // indirect
|
github.com/ulikunitz/xz v0.5.9 // indirect
|
||||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
||||||
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
|
golang.org/x/term v0.11.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.19.0 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
|
||||||
golang.org/x/term v0.13.0 // indirect
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
|
||||||
gopkg.in/fsnotify.v1 v1.4.7 // indirect
|
gopkg.in/fsnotify.v1 v1.4.7 // indirect
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||||
)
|
)
|
||||||
@@ -89,7 +77,7 @@ require (
|
|||||||
github.com/go-audio/riff v1.0.0 // indirect
|
github.com/go-audio/riff v1.0.0 // indirect
|
||||||
github.com/go-logr/logr v1.2.4 // indirect
|
github.com/go-logr/logr v1.2.4 // indirect
|
||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
|
||||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.16.7 // indirect
|
github.com/klauspost/compress v1.16.7 // indirect
|
||||||
@@ -102,8 +90,8 @@ require (
|
|||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||||
golang.org/x/net v0.17.0 // indirect
|
golang.org/x/net v0.14.0 // indirect
|
||||||
golang.org/x/sys v0.13.0 // indirect
|
golang.org/x/sys v0.12.0 // indirect
|
||||||
golang.org/x/text v0.13.0 // indirect
|
golang.org/x/text v0.12.0 // indirect
|
||||||
golang.org/x/tools v0.12.0 // indirect
|
golang.org/x/tools v0.12.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
85
go.sum
85
go.sum
@@ -1,16 +1,13 @@
|
|||||||
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
||||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
|
||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -26,17 +23,16 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo
|
|||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230628193450-85ed71aaec8e h1:KtbU2JR3lJuXFASHG2+sVLucfMPBjWKUUKByX6C81mQ=
|
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230628193450-85ed71aaec8e h1:KtbU2JR3lJuXFASHG2+sVLucfMPBjWKUUKByX6C81mQ=
|
||||||
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230628193450-85ed71aaec8e/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo=
|
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230628193450-85ed71aaec8e/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo=
|
||||||
|
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20231015123506-54c978c3a31d h1:8xqu9FldzgWNYBOQJWis5+1it5HUZ1anQa9icU8RZcw=
|
||||||
|
github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20231015123506-54c978c3a31d/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo=
|
||||||
github.com/go-audio/audio v1.0.0 h1:zS9vebldgbQqktK4H0lUqWrG8P0NxCJVqcj7ZpNnwd4=
|
github.com/go-audio/audio v1.0.0 h1:zS9vebldgbQqktK4H0lUqWrG8P0NxCJVqcj7ZpNnwd4=
|
||||||
github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
|
github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
|
||||||
github.com/go-audio/riff v1.0.0 h1:d8iCGbDvox9BfLagY94fBynxSPHO80LmZCaOsmKxokA=
|
github.com/go-audio/riff v1.0.0 h1:d8iCGbDvox9BfLagY94fBynxSPHO80LmZCaOsmKxokA=
|
||||||
github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498=
|
github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498=
|
||||||
github.com/go-audio/wav v1.1.0 h1:jQgLtbqBzY7G+BM8fXF7AHUk1uHUviWS4X39d5rsL2g=
|
github.com/go-audio/wav v1.1.0 h1:jQgLtbqBzY7G+BM8fXF7AHUk1uHUviWS4X39d5rsL2g=
|
||||||
github.com/go-audio/wav v1.1.0/go.mod h1:mpe9qfwbScEbkd8uybLuIpTgHyrISw/OTuvjUW2iGtE=
|
github.com/go-audio/wav v1.1.0/go.mod h1:mpe9qfwbScEbkd8uybLuIpTgHyrISw/OTuvjUW2iGtE=
|
||||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
|
||||||
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
||||||
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
|
||||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
|
||||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
github.com/go-skynet/bloomz.cpp v0.0.0-20230529155654-1834e77b83fa h1:gxr68r/6EWroay4iI81jxqGCDbKotY4+CiwdUkBz2NQ=
|
github.com/go-skynet/bloomz.cpp v0.0.0-20230529155654-1834e77b83fa h1:gxr68r/6EWroay4iI81jxqGCDbKotY4+CiwdUkBz2NQ=
|
||||||
@@ -51,8 +47,8 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78
|
|||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/gofiber/fiber/v2 v2.50.0 h1:ia0JaB+uw3GpNSCR5nvC5dsaxXjRU5OEu36aytx+zGw=
|
github.com/gofiber/fiber/v2 v2.49.2 h1:ONEN3/Vc+dUCxxDgZZwpqvhISgHqb+bu+isBiEyKEQs=
|
||||||
github.com/gofiber/fiber/v2 v2.50.0/go.mod h1:21eytvay9Is7S6z+OgPi7c7n4++tnClWmhpimVHMimw=
|
github.com/gofiber/fiber/v2 v2.49.2/go.mod h1:gNsKnyrmfEWFpJxQAV0qvW6l70K1dZGno12oLtukcts=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||||
@@ -73,8 +69,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
|
||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
@@ -99,8 +93,10 @@ github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs
|
|||||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
||||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||||
@@ -114,15 +110,12 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
|
|||||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
|
||||||
github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=
|
github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=
|
||||||
github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
|
github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
|
||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
|
||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/mudler/go-ggllm.cpp v0.0.0-20230709223052-862477d16eef h1:OJZtJ5vYhlkTJI0RHIl62kOkhiINQEhZgsXlwmmNDhM=
|
github.com/mudler/go-ggllm.cpp v0.0.0-20230709223052-862477d16eef h1:OJZtJ5vYhlkTJI0RHIl62kOkhiINQEhZgsXlwmmNDhM=
|
||||||
@@ -133,12 +126,10 @@ github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c h1:CI5uGw
|
|||||||
github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c/go.mod h1:gY3wyrhkRySJtmtI/JPt4a2mKv48h/M9pEZIW+SjeC0=
|
github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c/go.mod h1:gY3wyrhkRySJtmtI/JPt4a2mKv48h/M9pEZIW+SjeC0=
|
||||||
github.com/mudler/go-stable-diffusion v0.0.0-20230605122230-d89260f598af h1:XFq6OUqsWQam0OrEr05okXsJK/TQur3zoZTHbiZD3Ks=
|
github.com/mudler/go-stable-diffusion v0.0.0-20230605122230-d89260f598af h1:XFq6OUqsWQam0OrEr05okXsJK/TQur3zoZTHbiZD3Ks=
|
||||||
github.com/mudler/go-stable-diffusion v0.0.0-20230605122230-d89260f598af/go.mod h1:8ufRkpz/S/9ahkaxzZ5i4WMgO9w4InEhuRoT7vK5Rnw=
|
github.com/mudler/go-stable-diffusion v0.0.0-20230605122230-d89260f598af/go.mod h1:8ufRkpz/S/9ahkaxzZ5i4WMgO9w4InEhuRoT7vK5Rnw=
|
||||||
|
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231012185707-10f9b49313d0 h1:cvx7GSYYXMnmLLHey5qF9QjS0nPyOk8tsozPvhwLvgs=
|
||||||
|
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231012185707-10f9b49313d0/go.mod h1:4T3CHXyrt+7FQHXaxULZfPjHbD8/99WuDDJa0YVZARI=
|
||||||
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231013181651-22de3c56bdd4 h1:82J4t94Mmt0lva/OoxNlHkKrMSdSUZXkAjTFnlFFsow=
|
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231013181651-22de3c56bdd4 h1:82J4t94Mmt0lva/OoxNlHkKrMSdSUZXkAjTFnlFFsow=
|
||||||
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231013181651-22de3c56bdd4/go.mod h1:4T3CHXyrt+7FQHXaxULZfPjHbD8/99WuDDJa0YVZARI=
|
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231013181651-22de3c56bdd4/go.mod h1:4T3CHXyrt+7FQHXaxULZfPjHbD8/99WuDDJa0YVZARI=
|
||||||
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231016205817-9a19c740ee84 h1:AiFzd+M2Uxz67fdn4nCnKR70me5yf88rXhoqhvfRDak=
|
|
||||||
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231016205817-9a19c740ee84/go.mod h1:4T3CHXyrt+7FQHXaxULZfPjHbD8/99WuDDJa0YVZARI=
|
|
||||||
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231022042237-c25dc5193530 h1:YXMxHwHMB9jCBo2Yu5gz3mTB3T1TnZs/HmPLv15LUSA=
|
|
||||||
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20231022042237-c25dc5193530/go.mod h1:4T3CHXyrt+7FQHXaxULZfPjHbD8/99WuDDJa0YVZARI=
|
|
||||||
github.com/nwaples/rardecode v1.1.0 h1:vSxaY8vQhOcVr4mm5e8XllHWTiM4JF507A0Katqw7MQ=
|
github.com/nwaples/rardecode v1.1.0 h1:vSxaY8vQhOcVr4mm5e8XllHWTiM4JF507A0Katqw7MQ=
|
||||||
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
|
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
|
||||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
@@ -155,8 +146,6 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
|
|||||||
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||||
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
|
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
|
||||||
github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
|
github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
|
||||||
github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA=
|
|
||||||
github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
|
|
||||||
github.com/otiai10/mint v1.6.1 h1:kgbTJmOpp/0ce7hk3H8jiSuR0MXmpwWRfqUdKww17qg=
|
github.com/otiai10/mint v1.6.1 h1:kgbTJmOpp/0ce7hk3H8jiSuR0MXmpwWRfqUdKww17qg=
|
||||||
github.com/otiai10/mint v1.6.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
|
github.com/otiai10/mint v1.6.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
|
||||||
github.com/otiai10/openaigo v1.6.0 h1:YTQEbtDSvawETOB/Kmb/6JvuHdHH/eIpSQfHVufiwY8=
|
github.com/otiai10/openaigo v1.6.0 h1:YTQEbtDSvawETOB/Kmb/6JvuHdHH/eIpSQfHVufiwY8=
|
||||||
@@ -172,23 +161,15 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
||||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||||
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
|
|
||||||
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
|
|
||||||
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM=
|
|
||||||
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
|
|
||||||
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
|
|
||||||
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
|
|
||||||
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
|
|
||||||
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
|
|
||||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
|
||||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
|
||||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
|
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
|
||||||
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/sashabaranov/go-openai v1.15.4 h1:BXCR0Uxk5RipeY4yBC7g6pBVfcjh8jwrMNOYdie6yuk=
|
||||||
|
github.com/sashabaranov/go-openai v1.15.4/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
||||||
github.com/sashabaranov/go-openai v1.16.0 h1:34W6WV84ey6OpW0p2UewZkdMu82AxGC+BzpU6iiauRw=
|
github.com/sashabaranov/go-openai v1.16.0 h1:34W6WV84ey6OpW0p2UewZkdMu82AxGC+BzpU6iiauRw=
|
||||||
github.com/sashabaranov/go-openai v1.16.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
github.com/sashabaranov/go-openai v1.16.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
||||||
github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE=
|
github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE=
|
||||||
@@ -216,10 +197,8 @@ github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0h
|
|||||||
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
|
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
|
||||||
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
|
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
|
||||||
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
||||||
github.com/tmc/langchaingo v0.0.0-20231016073620-a02d4fdc0f3a h1:BziGpoF5ZVWMDy6Z1adXnYndRye2fiYWZlmknUFksGA=
|
github.com/tmc/langchaingo v0.0.0-20230929160525-e16b77704b8d h1:i4+wYULVM2/3Yb/aDE7Z4s2v7vqtQERQWh5lopBEuig=
|
||||||
github.com/tmc/langchaingo v0.0.0-20231016073620-a02d4fdc0f3a/go.mod h1:SiwyRS7sBSSi6f3NB4dKENw69X6br/wZ2WRkM+8pZWk=
|
github.com/tmc/langchaingo v0.0.0-20230929160525-e16b77704b8d/go.mod h1:R+a8fqt6nmKyYj7KSpr/m9oxqE6OJLbLyO9pxeHpjLU=
|
||||||
github.com/tmc/langchaingo v0.0.0-20231019140956-c636b3da7701 h1:LquLgmFiKf6eDXdwoUKCIGn5NsR34cLXC6ySYhiE6bA=
|
|
||||||
github.com/tmc/langchaingo v0.0.0-20231019140956-c636b3da7701/go.mod h1:SiwyRS7sBSSi6f3NB4dKENw69X6br/wZ2WRkM+8pZWk=
|
|
||||||
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
github.com/ulikunitz/xz v0.5.9 h1:RsKRIA2MO8x56wkkcd3LbtcE/uMszhb6DpRf+3uwa3I=
|
github.com/ulikunitz/xz v0.5.9 h1:RsKRIA2MO8x56wkkcd3LbtcE/uMszhb6DpRf+3uwa3I=
|
||||||
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
@@ -238,18 +217,6 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr
|
|||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
||||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||||
go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs=
|
|
||||||
go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY=
|
|
||||||
go.opentelemetry.io/otel/exporters/prometheus v0.42.0 h1:jwV9iQdvp38fxXi8ZC+lNpxjK16MRcZlpDYvbuO1FiA=
|
|
||||||
go.opentelemetry.io/otel/exporters/prometheus v0.42.0/go.mod h1:f3bYiqNqhoPxkvI2LrXqQVC546K7BuRDL/kKuxkujhA=
|
|
||||||
go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE=
|
|
||||||
go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8=
|
|
||||||
go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o=
|
|
||||||
go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A=
|
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.19.0 h1:EJoTO5qysMsYCa+w4UghwFV/ptQgqSL/8Ni+hx+8i1k=
|
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.19.0/go.mod h1:XjG0jQyFJrv2PbMvwND7LwCEhsJzCzV5210euduKcKY=
|
|
||||||
go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg=
|
|
||||||
go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
@@ -262,10 +229,9 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
|
|||||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@@ -288,18 +254,17 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
|
||||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
|
||||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
@@ -311,12 +276,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
|||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4=
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
|
|
||||||
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
|
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
|
||||||
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
|
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
|
||||||
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
|
|
||||||
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
|||||||
7
main.go
7
main.go
@@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/go-skynet/LocalAI/internal"
|
"github.com/go-skynet/LocalAI/internal"
|
||||||
"github.com/go-skynet/LocalAI/pkg/gallery"
|
"github.com/go-skynet/LocalAI/pkg/gallery"
|
||||||
model "github.com/go-skynet/LocalAI/pkg/model"
|
model "github.com/go-skynet/LocalAI/pkg/model"
|
||||||
"github.com/go-skynet/LocalAI/metrics"
|
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
progressbar "github.com/schollz/progressbar/v3"
|
progressbar "github.com/schollz/progressbar/v3"
|
||||||
@@ -215,12 +214,6 @@ For a list of compatible model, check out: https://localai.io/model-compatibilit
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics, err := metrics.SetupMetrics()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
opts = append(opts, options.WithMetrics(metrics))
|
|
||||||
|
|
||||||
app, err := api.App(opts...)
|
app, err := api.App(opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
package metrics
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
|
||||||
"github.com/gofiber/fiber/v2/middleware/adaptor"
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/exporters/prometheus"
|
|
||||||
api "go.opentelemetry.io/otel/metric"
|
|
||||||
"go.opentelemetry.io/otel/sdk/metric"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Metrics struct {
|
|
||||||
meter api.Meter
|
|
||||||
apiTimeMetric api.Float64Histogram
|
|
||||||
}
|
|
||||||
|
|
||||||
// setupOTelSDK bootstraps the OpenTelemetry pipeline.
|
|
||||||
// If it does not return an error, make sure to call shutdown for proper cleanup.
|
|
||||||
func SetupMetrics() (*Metrics, error) {
|
|
||||||
exporter, err := prometheus.New()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
provider := metric.NewMeterProvider(metric.WithReader(exporter))
|
|
||||||
meter := provider.Meter("github.com/go-skynet/LocalAI")
|
|
||||||
|
|
||||||
apiTimeMetric, err := meter.Float64Histogram("api_call", api.WithDescription("api calls"))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &Metrics{
|
|
||||||
meter: meter,
|
|
||||||
apiTimeMetric: apiTimeMetric,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func MetricsHandler() fiber.Handler {
|
|
||||||
return adaptor.HTTPHandler(promhttp.Handler())
|
|
||||||
}
|
|
||||||
|
|
||||||
type apiMiddlewareConfig struct {
|
|
||||||
Filter func(c *fiber.Ctx) bool
|
|
||||||
metrics *Metrics
|
|
||||||
}
|
|
||||||
|
|
||||||
func APIMiddleware(metrics *Metrics) fiber.Handler {
|
|
||||||
cfg := apiMiddlewareConfig{
|
|
||||||
metrics: metrics,
|
|
||||||
Filter: func(c *fiber.Ctx) bool {
|
|
||||||
if c.Path() == "/metrics" {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return func(c *fiber.Ctx) error {
|
|
||||||
if cfg.Filter != nil && cfg.Filter(c) {
|
|
||||||
return c.Next()
|
|
||||||
}
|
|
||||||
path := c.Path()
|
|
||||||
method := c.Method()
|
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
err := c.Next()
|
|
||||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
|
||||||
cfg.metrics.ObserveAPICall(method, path, elapsed)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Metrics) ObserveAPICall(method string, path string, duration float64) {
|
|
||||||
opts := api.WithAttributes(
|
|
||||||
attribute.String("method", method),
|
|
||||||
attribute.String("path", path),
|
|
||||||
)
|
|
||||||
m.apiTimeMetric.Record(context.Background(), duration, opts)
|
|
||||||
}
|
|
||||||
59
pkg/backend/llm/bloomz/bloomz.go
Normal file
59
pkg/backend/llm/bloomz/bloomz.go
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package bloomz
|
||||||
|
|
||||||
|
// This is a wrapper to statisfy the GRPC service interface
|
||||||
|
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/go-skynet/LocalAI/pkg/grpc/base"
|
||||||
|
pb "github.com/go-skynet/LocalAI/pkg/grpc/proto"
|
||||||
|
|
||||||
|
"github.com/go-skynet/bloomz.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LLM struct {
|
||||||
|
base.SingleThread
|
||||||
|
|
||||||
|
bloomz *bloomz.Bloomz
|
||||||
|
}
|
||||||
|
|
||||||
|
func (llm *LLM) Load(opts *pb.ModelOptions) error {
|
||||||
|
model, err := bloomz.New(opts.ModelFile)
|
||||||
|
llm.bloomz = model
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildPredictOptions(opts *pb.PredictOptions) []bloomz.PredictOption {
|
||||||
|
predictOptions := []bloomz.PredictOption{
|
||||||
|
bloomz.SetTemperature(float64(opts.Temperature)),
|
||||||
|
bloomz.SetTopP(float64(opts.TopP)),
|
||||||
|
bloomz.SetTopK(int(opts.TopK)),
|
||||||
|
bloomz.SetTokens(int(opts.Tokens)),
|
||||||
|
bloomz.SetThreads(int(opts.Threads)),
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Seed != 0 {
|
||||||
|
predictOptions = append(predictOptions, bloomz.SetSeed(int(opts.Seed)))
|
||||||
|
}
|
||||||
|
|
||||||
|
return predictOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
func (llm *LLM) Predict(opts *pb.PredictOptions) (string, error) {
|
||||||
|
return llm.bloomz.Predict(opts.Prompt, buildPredictOptions(opts)...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// fallback to Predict
|
||||||
|
func (llm *LLM) PredictStream(opts *pb.PredictOptions, results chan string) error {
|
||||||
|
go func() {
|
||||||
|
res, err := llm.bloomz.Predict(opts.Prompt, buildPredictOptions(opts)...)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("err: ", err)
|
||||||
|
}
|
||||||
|
results <- res
|
||||||
|
close(results)
|
||||||
|
}()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
145
pkg/backend/llm/falcon/falcon.go
Normal file
145
pkg/backend/llm/falcon/falcon.go
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
package falcon
|
||||||
|
|
||||||
|
// This is a wrapper to statisfy the GRPC service interface
|
||||||
|
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/go-skynet/LocalAI/pkg/grpc/base"
|
||||||
|
pb "github.com/go-skynet/LocalAI/pkg/grpc/proto"
|
||||||
|
|
||||||
|
ggllm "github.com/mudler/go-ggllm.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LLM struct {
|
||||||
|
base.SingleThread
|
||||||
|
|
||||||
|
falcon *ggllm.Falcon
|
||||||
|
}
|
||||||
|
|
||||||
|
func (llm *LLM) Load(opts *pb.ModelOptions) error {
|
||||||
|
ggllmOpts := []ggllm.ModelOption{}
|
||||||
|
if opts.ContextSize != 0 {
|
||||||
|
ggllmOpts = append(ggllmOpts, ggllm.SetContext(int(opts.ContextSize)))
|
||||||
|
}
|
||||||
|
// F16 doesn't seem to produce good output at all!
|
||||||
|
//if c.F16 {
|
||||||
|
// llamaOpts = append(llamaOpts, llama.EnableF16Memory)
|
||||||
|
//}
|
||||||
|
|
||||||
|
if opts.NGPULayers != 0 {
|
||||||
|
ggllmOpts = append(ggllmOpts, ggllm.SetGPULayers(int(opts.NGPULayers)))
|
||||||
|
}
|
||||||
|
|
||||||
|
ggllmOpts = append(ggllmOpts, ggllm.SetMMap(opts.MMap))
|
||||||
|
ggllmOpts = append(ggllmOpts, ggllm.SetMainGPU(opts.MainGPU))
|
||||||
|
ggllmOpts = append(ggllmOpts, ggllm.SetTensorSplit(opts.TensorSplit))
|
||||||
|
if opts.NBatch != 0 {
|
||||||
|
ggllmOpts = append(ggllmOpts, ggllm.SetNBatch(int(opts.NBatch)))
|
||||||
|
} else {
|
||||||
|
ggllmOpts = append(ggllmOpts, ggllm.SetNBatch(512))
|
||||||
|
}
|
||||||
|
|
||||||
|
model, err := ggllm.New(opts.ModelFile, ggllmOpts...)
|
||||||
|
llm.falcon = model
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildPredictOptions(opts *pb.PredictOptions) []ggllm.PredictOption {
|
||||||
|
predictOptions := []ggllm.PredictOption{
|
||||||
|
ggllm.SetTemperature(float64(opts.Temperature)),
|
||||||
|
ggllm.SetTopP(float64(opts.TopP)),
|
||||||
|
ggllm.SetTopK(int(opts.TopK)),
|
||||||
|
ggllm.SetTokens(int(opts.Tokens)),
|
||||||
|
ggllm.SetThreads(int(opts.Threads)),
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.PromptCacheAll {
|
||||||
|
predictOptions = append(predictOptions, ggllm.EnablePromptCacheAll)
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.PromptCacheRO {
|
||||||
|
predictOptions = append(predictOptions, ggllm.EnablePromptCacheRO)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expected absolute path
|
||||||
|
if opts.PromptCachePath != "" {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetPathPromptCache(opts.PromptCachePath))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Mirostat != 0 {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetMirostat(int(opts.Mirostat)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.MirostatETA != 0 {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetMirostatETA(float64(opts.MirostatETA)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.MirostatTAU != 0 {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetMirostatTAU(float64(opts.MirostatTAU)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Debug {
|
||||||
|
predictOptions = append(predictOptions, ggllm.Debug)
|
||||||
|
}
|
||||||
|
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetStopWords(opts.StopPrompts...))
|
||||||
|
|
||||||
|
if opts.PresencePenalty != 0 {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetPenalty(float64(opts.PresencePenalty)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.NKeep != 0 {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetNKeep(int(opts.NKeep)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Batch != 0 {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetBatch(int(opts.Batch)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.IgnoreEOS {
|
||||||
|
predictOptions = append(predictOptions, ggllm.IgnoreEOS)
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Seed != 0 {
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetSeed(int(opts.Seed)))
|
||||||
|
}
|
||||||
|
|
||||||
|
//predictOptions = append(predictOptions, llama.SetLogitBias(c.Seed))
|
||||||
|
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetFrequencyPenalty(float64(opts.FrequencyPenalty)))
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetMlock(opts.MLock))
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetMemoryMap(opts.MMap))
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetPredictionMainGPU(opts.MainGPU))
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetPredictionTensorSplit(opts.TensorSplit))
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetTailFreeSamplingZ(float64(opts.TailFreeSamplingZ)))
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetTypicalP(float64(opts.TypicalP)))
|
||||||
|
return predictOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
func (llm *LLM) Predict(opts *pb.PredictOptions) (string, error) {
|
||||||
|
return llm.falcon.Predict(opts.Prompt, buildPredictOptions(opts)...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (llm *LLM) PredictStream(opts *pb.PredictOptions, results chan string) error {
|
||||||
|
|
||||||
|
predictOptions := buildPredictOptions(opts)
|
||||||
|
|
||||||
|
predictOptions = append(predictOptions, ggllm.SetTokenCallback(func(token string) bool {
|
||||||
|
if token == "<|endoftext|>" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
results <- token
|
||||||
|
return true
|
||||||
|
}))
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
_, err := llm.falcon.Predict(opts.Prompt, predictOptions...)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("err: ", err)
|
||||||
|
}
|
||||||
|
close(results)
|
||||||
|
}()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user