Skip to content

Commit

Permalink
Prepare containers to run with ai-lab-recipes
Browse files Browse the repository at this point in the history
Add two new scripts llama-server.sh and whisper-server.sh which
can handle environment variables from the ai-lab-recipes.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Feb 13, 2025
1 parent 173cae3 commit bf0d770
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
3 changes: 3 additions & 0 deletions container-images/cuda/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ RUN dnf install -y python3 && \
# Copy the entire installation directory from the builder
COPY --from=builder /tmp/install /usr

ENV MODEL_PATH=/mnt/models/model.file

COPY --chmod=755 ../scripts /usr/bin
8 changes: 5 additions & 3 deletions container-images/ramalama/Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM registry.access.redhat.com/ubi9/ubi:9.5-1739449058

COPY ../scripts /scripts
RUN chmod +x /scripts/*.sh && \
/scripts/build_llama_and_whisper.sh "ramalama"
ENV MODEL_PATH=/mnt/models/model.file

COPY --chmod=755 ../scripts /usr/bin

RUN /usr/bin/build_llama_and_whisper.sh "ramalama"
18 changes: 18 additions & 0 deletions container-images/scripts/llama-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
if [ -n "${MODEL_CHAT_FORMAT}" ]; then
CHAT_FORMAT="--chat_template ${MODEL_CHAT_FORMAT}"
fi

if [ -n ${MODEL_PATH} ]; then
llama-server \
--model ${MODEL_PATH} \
--host ${HOST:=0.0.0.0} \
--port ${PORT:=8001} \
--gpu_layers ${GPU_LAYERS:=0} \
${CHAT_FORMAT}
exit 0
fi

echo "Please set a MODEL_PATH"
exit 1

13 changes: 13 additions & 0 deletions container-images/scripts/whisper-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
if [ -n ${MODEL_PATH} ]; then
whisper-server \
-tr \
--model ${MODEL_PATH} \
--convert \
--host ${HOST:=0.0.0.0} \
--port ${PORT:=8001}
exit 0
fi

echo "Please set a MODEL_PATH"
exit 1
8 changes: 5 additions & 3 deletions container-images/vulkan/Containerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM registry.access.redhat.com/ubi9/ubi:9.5-1739449058

COPY ../scripts /scripts
RUN chmod +x /scripts/*.sh && \
/scripts/build_llama_and_whisper.sh "vulkan"
ENV MODEL_PATH=/mnt/models/model.file

COPY --chmod=755 ../scripts /usr/bin

RUN /usr/bin/build_llama_and_whisper.sh "ramalama"

0 comments on commit bf0d770

Please sign in to comment.