Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update containerfile with download #6

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions loadmodel/Containerfile-model
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This containerfile downloads a model
FROM registry.access.redhat.com/ubi9/ubi:9.3-1476 as model
WORKDIR /model
ARG MODEL_URL=https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_M.gguf?download=true
ARG MODEL_FILE=llama-2-7b-chat.Q4_K_M.gguf
RUN dnf install -y wget
RUN wget -O $MODEL_FILE $MODEL_URL

FROM registry.access.redhat.com/ubi9-micro:9.3-9
WORKDIR /model
ARG MODEL_URL=https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_M.gguf?download=true
ARG MODEL_FILE=llama-2-7b-chat.Q4_K_M.gguf
ENV MODEL_FILE=$MODEL_FILE
COPY --from=model /model/${MODEL_FILE} /model/
21 changes: 10 additions & 11 deletions Containerfile-rh → loadmodel/Containerfile-with-app
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# This containerfile downloads a model and embeds a text generation application
FROM registry.access.redhat.com/ubi9:9.3-1361.1699548029 AS model

WORKDIR /locallm
ARG MODEL_URL=https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_M.gguf?download=true
ARG MODEL_FILE=llama-2-7b-chat.Q4_K_M.gguf

RUN dnf install -y wget
RUN wget -O $MODEL_FILE $MODEL_URL

FROM registry.access.redhat.com/ubi9/python-311:1-34.1699551735

WORKDIR /locallm
ARG MODEL_FILE=llama-2-7b-chat.Q4_K_M.gguf
ENV MODEL_FILE=$MODEL_FILE
COPY --from=model $MODEL_FILE .
ADD app.py .
ADD chat.py .
ADD requirements.txt .
ADD run_locallm.py .
COPY ../requirements.txt /locallm/requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r requirements.txt
CMD python app.py
RUN pip install --no-cache-dir --upgrade -r /locallm/requirements.txt
ENV MODEL_FILE=$MODEL_FILE
COPY --from=model /locallm/${MODEL_FILE} /locallm/
COPY ../src/ /locallm
ENTRYPOINT [ "python", "app.py" ]