Skip to content

Commit

Permalink
Begin process of packaging PRAGmatic
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Jan 20, 2025
1 parent 25168aa commit 1fe5997
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions container-images/scripts/build_llama_and_whisper.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash

dnf_install() {
local rpm_list=("python3" "python3-pip" "python3-argcomplete" \
"python3-dnf-plugin-versionlock" "gcc-c++" "cmake" "vim" \
"procps-ng" "git" "dnf-plugins-core" "libcurl-devel")
local rpm_list=( "python3" "python3-pip" "python3-argcomplete" \
"python3-dnf-plugin-versionlock" "gcc-c++" "cmake" "vim" \
"procps-ng" "git" "dnf-plugins-core" "libcurl-devel")
local vulkan_rpms=("vulkan-headers" "vulkan-loader-devel" "vulkan-tools" \
"spirv-tools" "glslc" "glslang")
"spirv-tools" "glslc" "glslang")

# All the UBI-based ones
if [ "$containerfile" = "ramalama" ] || [ "$containerfile" = "rocm" ] || \
[ "$containerfile" = "vulkan" ]; then
local url="https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm"
dnf install -y "$url"
crb enable # this is in epel-release, can only install epel-release via url
dnf --enablerepo=ubi-9-appstream-rpms install -y "${rpm_list[@]}"
dnf --enablerepo=ubi-9-appstream-rpms install -y "${rpm_list[@]}" python3.11 python3.11-pip
local uname_m
uname_m="$(uname -m)"
dnf copr enable -y slp/mesa-krunkit "epel-9-$uname_m"
Expand Down Expand Up @@ -94,6 +94,19 @@ clone_and_build_llama_cpp() {
cd ..
}

clone_and_build_pragmatic() {
git clone https://github.com/redhat-et/PRAGmatic
cd PRAGmatic
git submodule update --init --recursive
if [ "$containerfile" != "asahi" ]; then
PYTHON_VERSION="/usr/bin/python3.11 -m "
fi

${PYTHON_VERSION} pip install -r requirements.txt --prefix=/usr
${PYTHON_VERSION} pip install --prefix=/usr
cd ..
}

main() {
set -ex

Expand All @@ -104,6 +117,8 @@ main() {
configure_common_flags
common_flags+=("-DGGML_CCACHE=0" "-DCMAKE_INSTALL_PREFIX=$install_prefix")
dnf_install
clone_and_build_pragmatic

clone_and_build_whisper_cpp
case "$containerfile" in
ramalama)
Expand All @@ -114,10 +129,11 @@ main() {
clone_and_build_llama_cpp
dnf clean all
rm -rf /var/cache/*dnf* /opt/rocm-*/lib/llvm \
/root/.cache /root/buildinfo \
/opt/rocm-*/lib/rocblas/library/*gfx9* \
/opt/rocm-*/lib/hipblaslt/library/*gfx9* llama.cpp whisper.cpp
/opt/rocm-*/lib/hipblaslt/library/*gfx9* llama.cpp whisper.cpp PRAGmatic
ldconfig # needed for libraries

}

main "$@"

0 comments on commit 1fe5997

Please sign in to comment.