From 9c8ae16c614b33a4adbe86ec350994b88dd2e750 Mon Sep 17 00:00:00 2001 From: Liora Milbaum Date: Thu, 11 Apr 2024 16:46:33 +0300 Subject: [PATCH] Build cuda image Signed-off-by: Liora Milbaum --- .github/workflows/model_servers.yaml | 39 +++++++++++++++---- .../llamacpp_python/cuda/Containerfile | 5 +-- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/.github/workflows/model_servers.yaml b/.github/workflows/model_servers.yaml index 1f1639cec..056d6f373 100644 --- a/.github/workflows/model_servers.yaml +++ b/.github/workflows/model_servers.yaml @@ -26,8 +26,13 @@ jobs: include: - image_name: llamacpp_python model: mistral + type: base + - image_name: llamacpp_python_cuda + model: mistral + type: cuda - image_name: whispercpp model: whisper-small + type: base runs-on: ubuntu-latest permissions: contents: read @@ -45,14 +50,25 @@ jobs: sudo apt-get update sudo apt-get install -y qemu-user-static - - name: Build Image - id: build_image + - name: Build Image (base) + id: build_image_base + if: matrix.type == 'base' uses: redhat-actions/buildah-build@v2.13 with: image: ${{ env.REGISTRY }}/${{ github.repository_owner}}/${{ matrix.image_name }} platforms: linux/amd64, linux/arm64 tags: latest - containerfiles: ./model_servers/${{ matrix.image_name }}/base/Containerfile + containerfiles: ./model_servers/${{ matrix.image_name }}/${{ matrix.type }}/Containerfile + context: model_servers/${{ matrix.image_name }}/ + + - name: Build Image (cuda) + id: build_image_cuda + if: matrix.type == 'cuda' + uses: redhat-actions/buildah-build@v2.13 + with: + image: ${{ env.REGISTRY }}/${{ github.repository_owner}}/${{ matrix.image_name }} + tags: latest + containerfiles: ./model_servers/${{ matrix.image_name }}/${{ matrix.type }}/Containerfile context: model_servers/${{ matrix.image_name }}/ - name: Download model @@ -82,11 +98,18 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Push image - id: push_image - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + - name: Push image (base) + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.type == 'base' + uses: redhat-actions/push-to-registry@v2.8 + with: + image: ${{ steps.build_image_base.outputs.image }} + tags: ${{ steps.build_image_base.outputs.tags }} + registry: ${{ env.REGISTRY }} + + - name: Push image (cuda) + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.type == 'cuda' uses: redhat-actions/push-to-registry@v2.8 with: - image: ${{ steps.build_image.outputs.image }} - tags: ${{ steps.build_image.outputs.tags }} + image: ${{ steps.build_image_cuda.outputs.image }} + tags: ${{ steps.build_image_cuda.outputs.tags }} registry: ${{ env.REGISTRY }} diff --git a/model_servers/llamacpp_python/cuda/Containerfile b/model_servers/llamacpp_python/cuda/Containerfile index ed8ff3754..68bed76d4 100644 --- a/model_servers/llamacpp_python/cuda/Containerfile +++ b/model_servers/llamacpp_python/cuda/Containerfile @@ -1,8 +1,7 @@ FROM quay.io/opendatahub/workbench-images:cuda-ubi9-python-3.9-20231206 WORKDIR /locallm COPY src . -RUN pip install --upgrade pip ENV CMAKE_ARGS="-DLLAMA_CUBLAS=on" ENV FORCE_CMAKE=1 -RUN pip install --no-cache-dir --upgrade -r /locallm/requirements.txt -ENTRYPOINT [ "sh", "run.sh" ] \ No newline at end of file +RUN pip install --no-cache-dir -r ./requirements.txt +ENTRYPOINT [ "sh", "run.sh" ]