From d9a42cc4c53a14dadc24194c0a5030c05ec721b1 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sun, 29 Oct 2023 22:04:43 +0100 Subject: [PATCH] ci: run only cublas on selfhosted (#1224) * ci: run only cublas on selfhosted Signed-off-by: Ettore Di Giacinto * debug Signed-off-by: Ettore Di Giacinto * update git Signed-off-by: Ettore Di Giacinto * change testing embeddings model link Signed-off-by: Ettore Di Giacinto --------- Signed-off-by: Ettore Di Giacinto --- .github/workflows/image.yml | 159 +++++++++++++++++++++++++++++------- Makefile | 2 +- api/api_test.go | 2 +- 3 files changed, 131 insertions(+), 32 deletions(-) diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 2b1a7b62..94fe4486 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -24,45 +24,52 @@ jobs: tag-latest: 'auto' tag-suffix: '' ffmpeg: '' - - build-type: 'cublas' - cuda-major-version: 11 - cuda-minor-version: 7 - platforms: 'linux/amd64' - tag-latest: 'false' - tag-suffix: '-cublas-cuda11' - ffmpeg: '' - - build-type: 'cublas' - cuda-major-version: 12 - cuda-minor-version: 1 - platforms: 'linux/amd64' - tag-latest: 'false' - tag-suffix: '-cublas-cuda12' - ffmpeg: '' - build-type: '' platforms: 'linux/amd64' tag-latest: 'false' tag-suffix: '-ffmpeg' ffmpeg: 'true' - - build-type: 'cublas' - cuda-major-version: 11 - cuda-minor-version: 7 - platforms: 'linux/amd64' - tag-latest: 'false' - tag-suffix: '-cublas-cuda11-ffmpeg' - ffmpeg: 'true' - - build-type: 'cublas' - cuda-major-version: 12 - cuda-minor-version: 1 - platforms: 'linux/amd64' - tag-latest: 'false' - tag-suffix: '-cublas-cuda12-ffmpeg' - ffmpeg: 'true' - runs-on: docker-build + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - + - 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 id: meta uses: docker/metadata-action@v5 @@ -108,6 +115,98 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + + docker-gpu: + strategy: + matrix: + include: + - build-type: 'cublas' + cuda-major-version: 11 + cuda-minor-version: 7 + platforms: 'linux/amd64' + tag-latest: 'false' + tag-suffix: '-cublas-cuda11' + ffmpeg: '' + - build-type: 'cublas' + cuda-major-version: 12 + cuda-minor-version: 1 + platforms: 'linux/amd64' + tag-latest: 'false' + tag-suffix: '-cublas-cuda12' + ffmpeg: '' + - build-type: 'cublas' + cuda-major-version: 11 + cuda-minor-version: 7 + platforms: 'linux/amd64' + tag-latest: 'false' + tag-suffix: '-cublas-cuda11-ffmpeg' + ffmpeg: 'true' + - build-type: 'cublas' + cuda-major-version: 12 + cuda-minor-version: 1 + platforms: 'linux/amd64' + tag-latest: 'false' + tag-suffix: '-cublas-cuda12-ffmpeg' + ffmpeg: 'true' + + runs-on: arc-runner-set + steps: + - name: Force Install GIT latest + run: | + sudo apt-get update \ + && sudo apt-get install -y software-properties-common \ + && sudo apt-get update \ + && sudo add-apt-repository -y ppa:git-core/ppa \ + && sudo apt-get update \ + && sudo apt-get install -y git + - name: Checkout + uses: actions/checkout@v4 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: quay.io/go-skynet/local-ai + tags: | + type=ref,event=branch + type=semver,pattern={{raw}} + type=sha + flavor: | + latest=${{ matrix.tag-latest }} + suffix=${{ matrix.tag-suffix }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.LOCALAI_REGISTRY_USERNAME }} + password: ${{ secrets.LOCALAI_REGISTRY_PASSWORD }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + builder: ${{ steps.buildx.outputs.name }} + build-args: | + BUILD_TYPE=${{ matrix.build-type }} + CUDA_MAJOR_VERSION=${{ matrix.cuda-major-version }} + CUDA_MINOR_VERSION=${{ matrix.cuda-minor-version }} + FFMPEG=${{ matrix.ffmpeg }} + context: . + file: ./Dockerfile + platforms: ${{ matrix.platforms }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Release space from worker ♻ if: always() run: | diff --git a/Makefile b/Makefile index b5d47156..5c578db1 100644 --- a/Makefile +++ b/Makefile @@ -292,7 +292,7 @@ test-models/testmodel: mkdir test-dir wget https://huggingface.co/nnakasato/ggml-model-test/resolve/main/ggml-model-q4.bin -O test-models/testmodel wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin -O test-models/whisper-en - wget https://huggingface.co/skeskinen/ggml/resolve/main/all-MiniLM-L6-v2/ggml-model-q4_0.bin -O test-models/bert + wget https://huggingface.co/mudler/all-MiniLM-L6-v2/resolve/main/ggml-model-q4_0.bin -O test-models/bert wget https://cdn.openai.com/whisper/draft-20220913a/micro-machines.wav -O test-dir/audio.wav 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 https://raw.githubusercontent.com/saharNooby/rwkv.cpp/5eb8f09c146ea8124633ab041d9ea0b1f1db4459/rwkv/20B_tokenizer.json -O test-models/rwkv.tokenizer.json diff --git a/api/api_test.go b/api/api_test.go index 4e4fb340..4b91903b 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -687,7 +687,7 @@ var _ = Describe("API test", func() { Input: []string{"sun", "cat"}, }, ) - Expect(err).ToNot(HaveOccurred()) + Expect(err).ToNot(HaveOccurred(), err) Expect(len(resp.Data[0].Embedding)).To(BeNumerically("==", 384)) Expect(len(resp.Data[1].Embedding)).To(BeNumerically("==", 384))