From 07b50b42d50baf39b86a1c7c3d03724a28a21d7a Mon Sep 17 00:00:00 2001 From: Jeff MAURY Date: Tue, 26 Nov 2024 17:12:14 +0100 Subject: [PATCH] fix: update image to support usage info Signed-off-by: Jeff MAURY --- .github/workflows/build-publish.yaml | 5 +++++ .github/workflows/pr-check.yaml | 5 +++++ .github/workflows/release.yaml | 5 +++++ chat/base/Containerfile | 1 + chat/cuda/amd64/Containerfile | 1 + chat/requirements.txt | 2 +- chat/setup.sh | 6 ++++++ chat/vulkan/amd64/Containerfile | 1 + chat/vulkan/arm64/Containerfile | 1 + 9 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 chat/setup.sh diff --git a/.github/workflows/build-publish.yaml b/.github/workflows/build-publish.yaml index 8632b92..2c05f70 100644 --- a/.github/workflows/build-publish.yaml +++ b/.github/workflows/build-publish.yaml @@ -53,6 +53,11 @@ jobs: sudo apt-get update sudo apt-get install -y qemu-user-static + - name: Clone llama-cpp-python + run: | + cd chat + ./setup.sh + - name: Build Playground Image id: build-image uses: redhat-actions/buildah-build@v2 diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index e990f45..f0357f0 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -49,6 +49,11 @@ jobs: sudo apt-get update sudo apt-get install -y qemu-user-static + - name: Clone llama-cpp-python + run: | + cd chat + ./setup.sh + - name: Build Playground Image id: build-image uses: redhat-actions/buildah-build@v2 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2f8d840..5cc0f63 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -89,6 +89,11 @@ jobs: sudo apt-get update sudo apt-get install -y qemu-user-static + - name: Clone llama-cpp-python + run: | + cd chat + ./setup.sh + - name: Build Playground Image id: build-image uses: redhat-actions/buildah-build@v2 diff --git a/chat/base/Containerfile b/chat/base/Containerfile index 23efe9c..a2c59c9 100644 --- a/chat/base/Containerfile +++ b/chat/base/Containerfile @@ -21,6 +21,7 @@ RUN microdnf install -y python3 python3-pip gcc g++ shadow-utils && microdnf cle RUN useradd -r -g root -m -d /home/default -s /bin/bash default WORKDIR /home/default COPY requirements.txt requirements.txt +COPY llama-cpp-python llama-cpp-python RUN pip install --no-cache-dir --upgrade -r requirements.txt USER default COPY run.sh run.sh diff --git a/chat/cuda/amd64/Containerfile b/chat/cuda/amd64/Containerfile index 86d94c3..bf14595 100644 --- a/chat/cuda/amd64/Containerfile +++ b/chat/cuda/amd64/Containerfile @@ -20,6 +20,7 @@ RUN dnf install -y gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ USER 1001 WORKDIR /locallm COPY requirements.txt . +COPY --chown=1001 llama-cpp-python llama-cpp-python COPY run.sh . ENV CMAKE_ARGS="-DGGML_CUDA=on -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DLLAMA_F16C=OFF" ENV FORCE_CMAKE=1 diff --git a/chat/requirements.txt b/chat/requirements.txt index 8bee099..dc6afb3 100644 --- a/chat/requirements.txt +++ b/chat/requirements.txt @@ -1,2 +1,2 @@ -llama-cpp-python[server]==0.3.2 +./llama-cpp-python[server] pip==24.3.1 diff --git a/chat/setup.sh b/chat/setup.sh new file mode 100755 index 0000000..f9b2de6 --- /dev/null +++ b/chat/setup.sh @@ -0,0 +1,6 @@ +git clone https://github.com/abetlen/llama-cpp-python --no-checkout --recurse-submodules +cd llama-cpp-python +git checkout v0.3.2 +git submodule update +curl -O -L https://github.com/abetlen/llama-cpp-python/pull/1552.diff +git apply 1552.diff diff --git a/chat/vulkan/amd64/Containerfile b/chat/vulkan/amd64/Containerfile index 0dfe368..79bfeb3 100644 --- a/chat/vulkan/amd64/Containerfile +++ b/chat/vulkan/amd64/Containerfile @@ -32,6 +32,7 @@ RUN dnf install -y python3-dnf-plugin-versionlock && \ WORKDIR /locallm COPY requirements.txt ./ +COPY llama-cpp-python llama-cpp-python RUN pip install --upgrade pip ENV CMAKE_ARGS="-DGGML_VULKAN=on" ENV FORCE_CMAKE=1 diff --git a/chat/vulkan/arm64/Containerfile b/chat/vulkan/arm64/Containerfile index 48c9373..c130668 100644 --- a/chat/vulkan/arm64/Containerfile +++ b/chat/vulkan/arm64/Containerfile @@ -30,6 +30,7 @@ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ dnf install -y glslc && \ dnf clean all COPY requirements.txt ./ +COPY llama-cpp-python llama-cpp-python RUN pip install --upgrade pip ENV CMAKE_ARGS="-DGGML_VULKAN=on" ENV FORCE_CMAKE=1