Skip to content

Commit

Permalink
Merge branch 'main' of github.com:containers/ramalama into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rhatdan committed Oct 15, 2024
2 parents d7cfc27 + 230b6c7 commit caea6b2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ curl -fsSL https://raw.githubusercontent.com/containers/ramalama/s/install.sh |
| Apple Silicon GPU (macOS) | :white_check_mark: |
| Apple Silicon GPU (podman-machine) | :x: |
| Nvidia GPU (cuda) | :x: |
| AMD GPU (rocm) | :x: |
| AMD GPU (rocm) | :white_check_mark: |

## COMMANDS

Expand Down
2 changes: 1 addition & 1 deletion container-images/cpuonly/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM registry.access.redhat.com/ubi9/ubi:9.4-1214.1726694543
# renovate: datasource=github-releases depName=huggingface/huggingface_hub extractVersion=^v(?<version>.*)
ARG HUGGINGFACE_HUB_VERSION=0.25.2
# renovate: datasource=github-releases depName=containers/omlmd extractVersion=^v(?<version>.*)
ARG OMLMD_VERSION=0.1.5
ARG OMLMD_VERSION=0.1.6
# renovate: datasource=github-releases depName=tqdm/tqdm extractVersion=^v(?<version>.*)
ARG TQDM_VERSION=4.66.5
ARG LLAMA_CPP_SHA=70392f1f81470607ba3afef04aa56c9f65587664
Expand Down
4 changes: 2 additions & 2 deletions container-images/cuda/Containerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM docker.io/nvidia/cuda:12.6.1-devel-ubi9
FROM docker.io/nvidia/cuda:12.6.2-devel-ubi9

# renovate: datasource=github-releases depName=huggingface/huggingface_hub extractVersion=^v(?<version>.*)
ARG HUGGINGFACE_HUB_VERSION=0.25.2
# renovate: datasource=github-releases depName=containers/omlmd extractVersion=^v(?<version>.*)
ARG OMLMD_VERSION=0.1.5
ARG OMLMD_VERSION=0.1.6
ARG LLAMA_CPP_SHA=70392f1f81470607ba3afef04aa56c9f65587664
# renovate: datasource=git-refs depName=ggerganov/whisper.cpp packageName=https://github.com/ggerganov/whisper.cpp gitRef=master versioning=loose type=digest
ARG WHISPER_CPP_SHA=06a1da9daff94c1bf1b1d38950628264fe443f76
Expand Down
11 changes: 4 additions & 7 deletions container-images/rocm/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,21 @@ RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official

RUN dnf install -y rocm-dev hipblas-devel rocblas-devel && \
dnf clean all && \
rm -rf /var/cache/*dnf*

RUN git clone https://github.com/ggerganov/llama.cpp && \
git clone https://github.com/ggerganov/llama.cpp && \
cd llama.cpp && \
git reset --hard ${LLAMA_CPP_SHA} && \
cmake -B build -DCMAKE_INSTALL_PREFIX:PATH=/usr -DGGML_CCACHE=0 \
-DGGML_HIPBLAS=1 && \
cmake --build build --config Release -j $(nproc) && \
cmake --install build && \
cd / && \
rm -rf llama.cpp

RUN git clone https://github.com/ggerganov/whisper.cpp.git && \
git clone https://github.com/ggerganov/whisper.cpp.git && \
cd whisper.cpp && \
git reset --hard ${WHISPER_CPP_SHA} && \
make -j $(nproc) GGML_HIPBLAS=1 && \
mv main /usr/bin/whisper-main && \
mv server /usr/bin/whisper-server && \
cd / && \
rm -rf whisper.cpp
rm -rf /var/cache/*dnf* /opt/rocm-*/lib/llvm \
/opt/rocm-*/lib/rocblas/library/*gfx9* llama.cpp whisper.cpp

34 changes: 20 additions & 14 deletions container_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,30 @@ add_build_platform() {
conman_build+=("-t" "quay.io/ramalama/$image_name" ".")
}

rm_container_image() {
if [ "$image_name" == "cuda" ] || [ "$image_name" == "rocm" ]; then
"$conman_bin" rmi -f "$image_name" || true
fi
}

build() {
cd "$1"
local image_name
image_name=$(echo "$1" | sed "s#container-images/##g")
if [ "$image_name" != "rocm" ]; then # todo: skip, trim rocm image, too large
local conman_build=("${conman[@]}")
if [ "$#" -lt 2 ]; then
add_build_platform
"${conman_build[@]}" 2>&1 | tee container_build.log
elif [ "$2" = "-d" ]; then
add_build_platform
echo "${conman_build[@]}"
elif [ "$2" = "push" ]; then
"${conman[@]}" push "quay.io/ramalama/$image_name"
else
add_build_platform
"${conman_build[@]}" 2>&1 | tee container_build.log
fi
local conman_build=("${conman[@]}")
if [ "$#" -lt 2 ]; then
add_build_platform
"${conman_build[@]}" 2>&1 | tee container_build.log
rm_container_image
elif [ "$2" = "-d" ]; then
add_build_platform
echo "${conman_build[@]}"
elif [ "$2" = "push" ]; then
"${conman[@]}" push "quay.io/ramalama/$image_name"
else
add_build_platform
"${conman_build[@]}" 2>&1 | tee container_build.log
rm_container_image
fi

cd - > /dev/null
Expand Down
4 changes: 2 additions & 2 deletions ramalama/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def _list_containers(args):
if conman == "":
raise IndexError("no container manager (Podman, Docker) found")

conman_args = [conman, "ps", "-a", "--filter", "label=RAMALAMA container"]
conman_args = [conman, "ps", "-a", "--filter", "label=RAMALAMA"]
if args.noheading:
conman_args += ["--noheading"]
if hasattr(args, "notrunc") and args.notrunc:
Expand Down Expand Up @@ -568,7 +568,7 @@ def run_container(args):
"--rm",
"-i",
"--label",
"RAMALAMA container",
"RAMALAMA",
"--security-opt=label=disable",
"-e",
"RAMALAMA_TRANSPORT",
Expand Down
2 changes: 1 addition & 1 deletion test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ load helpers
model=m_$(safename)
image=m_$(safename)

verify_begin="podman run --rm -i --label \"RAMALAMA container\" --security-opt=label=disable -e RAMALAMA_TRANSPORT --name"
verify_begin="podman run --rm -i --label RAMALAMA --security-opt=label=disable -e RAMALAMA_TRANSPORT --name"

run_ramalama --dryrun run ${model}
is "$output" "${verify_begin} ramalama_.*" "dryrun correct"
Expand Down
2 changes: 1 addition & 1 deletion test/system/040-serve.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

load helpers

verify_begin="podman run --rm -i --label \"RAMALAMA container\" --security-opt=label=disable -e RAMALAMA_TRANSPORT --name"
verify_begin="podman run --rm -i --label RAMALAMA --security-opt=label=disable -e RAMALAMA_TRANSPORT --name"

@test "ramalama --dryrun serve basic output" {
skip_if_nocontainer
Expand Down

0 comments on commit caea6b2

Please sign in to comment.