diff --git a/container-images/cuda/Containerfile b/container-images/cuda/Containerfile index 5c743415..a7ce4e95 100644 --- a/container-images/cuda/Containerfile +++ b/container-images/cuda/Containerfile @@ -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 diff --git a/container-images/ramalama/Containerfile b/container-images/ramalama/Containerfile index 7034342d..ab27517f 100644 --- a/container-images/ramalama/Containerfile +++ b/container-images/ramalama/Containerfile @@ -1,5 +1,7 @@ FROM registry.access.redhat.com/ubi9/ubi:9.5-1738814488 -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" diff --git a/container-images/scripts/llama-server.sh b/container-images/scripts/llama-server.sh new file mode 100644 index 00000000..005b9820 --- /dev/null +++ b/container-images/scripts/llama-server.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [ "${MODEL_CHAT_FORMAT}" != "" ]; then + CHAT_FORMAT="--chat_template ${MODEL_CHAT_FORMAT}" +fi + +if [ ${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 + diff --git a/container-images/scripts/whisper-run.sh b/container-images/scripts/whisper-run.sh new file mode 100644 index 00000000..82e08bcc --- /dev/null +++ b/container-images/scripts/whisper-run.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +whisper-server \ + -tr \ + --model ${MODEL_PATH} \ + --convert \ + --host ${HOST:=0.0.0.0} \ + --port ${PORT:=8001} diff --git a/container-images/vulkan/Containerfile b/container-images/vulkan/Containerfile index 151360dc..252c464c 100644 --- a/container-images/vulkan/Containerfile +++ b/container-images/vulkan/Containerfile @@ -1,6 +1,8 @@ FROM registry.access.redhat.com/ubi9/ubi:9.5-1738814488 -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"