Skip to content

Instantly share code, notes, and snippets.

@MarioIshac
Forked from cgmb/build-llama-cpp.sh
Created December 21, 2024 09:41
Show Gist options
  • Save MarioIshac/cc7b520c2475a52f2fc0e3fb38c4d8b2 to your computer and use it in GitHub Desktop.
Save MarioIshac/cc7b520c2475a52f2fc0e3fb38c4d8b2 to your computer and use it in GitHub Desktop.
Build llama.cpp on Ubuntu 24.04
#!/bin/sh
# Build llama.cpp on Ubuntu 24.04 with AMD GPU support
sudo apt -y install git wget hipcc libhipblas-dev librocblas-dev cmake build-essential
# ensure you have the necessary permissions by adding yourself to the video and render groups
sudo usermod -aG video,render $USER
# reboot to apply the group changes
# run rocminfo to check everything is working thus far
rocminfo
# if it printed information about your GPU, that means it's working
# if you see an error message, fix the problem before continuing
# download a model
wget --continue https://huggingface.co/TheBloke/dolphin-2.2.1-mistral-7B-GGUF/resolve/main/dolphin-2.2.1-mistral-7b.Q5_K_M.gguf?download=true -O dolphin-2.2.1-mistral-7b.Q5_K_M.gguf
# build llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
git checkout b3267
HIPCXX=clang++-17 cmake -H. -Bbuild -DGGML_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release
make -j16 -C build
# run llama.cpp
build/bin/llama-cli -ngl 32 --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -m ../dolphin-2.2.1-mistral-7b.Q5_K_M.gguf --prompt "Once upon a time"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment