add LLM configuration and backend management components with automated setup scripts
This commit is contained in:
1 parent
822e9c9481
commit
20b81926b6
10 files changed
+575
-234
No files matched your search
+39
-1
@@ -31,10 +31,39 @@ download_and_extract() {
|
||||
|
||||
if [[ ! -x "$dest/llama-server" ]]; then
|
||||
echo " XX llama-server was not found after extracting $asset" >&2
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
download_and_extract_optional() {
|
||||
local asset="$1"
|
||||
local dest="$2"
|
||||
local reason="$3"
|
||||
|
||||
if [[ -x "$dest/llama-server" ]]; then
|
||||
echo " OK optional llama.cpp backend already ready: $dest"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if download_and_extract "$asset" "$dest"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo " !! Skipping optional llama.cpp backend for $reason ($asset)" >&2
|
||||
rm -rf "$dest"
|
||||
return 0
|
||||
}
|
||||
|
||||
has_command() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
has_linux_gpu_vendor() {
|
||||
local vendor="$1"
|
||||
[[ -d /sys/bus/pci/devices ]] || return 1
|
||||
grep -Ril "$vendor" /sys/bus/pci/devices/*/vendor >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if [[ "$PLATFORM" == "Darwin" ]]; then
|
||||
if [[ "$ARCH" == "arm64" ]]; then
|
||||
download_and_extract "llama-$RELEASE-bin-macos-arm64.tar.gz" "$APP_DIR/llm-backend/mac/arm64"
|
||||
@@ -46,6 +75,15 @@ elif [[ "$PLATFORM" == "Linux" ]]; then
|
||||
download_and_extract "llama-$RELEASE-bin-ubuntu-vulkan-arm64.tar.gz" "$APP_DIR/llm-backend/linux/vulkan"
|
||||
download_and_extract "llama-$RELEASE-bin-ubuntu-arm64.tar.gz" "$APP_DIR/llm-backend/linux/cpu"
|
||||
else
|
||||
if has_command nvidia-smi || has_linux_gpu_vendor "0x10de"; then
|
||||
download_and_extract_optional "llama-$RELEASE-bin-ubuntu-cuda-12.4-x64.tar.gz" "$APP_DIR/llm-backend/linux/cuda" "NVIDIA CUDA acceleration"
|
||||
fi
|
||||
if has_command rocminfo || has_linux_gpu_vendor "0x1002"; then
|
||||
download_and_extract_optional "llama-$RELEASE-bin-ubuntu-rocm-x64.tar.gz" "$APP_DIR/llm-backend/linux/rocm" "AMD ROCm acceleration"
|
||||
fi
|
||||
if has_linux_gpu_vendor "0x8086"; then
|
||||
download_and_extract_optional "llama-$RELEASE-bin-ubuntu-sycl-fp32-x64.tar.gz" "$APP_DIR/llm-backend/linux/sycl" "Intel SYCL acceleration"
|
||||
fi
|
||||
download_and_extract "llama-$RELEASE-bin-ubuntu-vulkan-x64.tar.gz" "$APP_DIR/llm-backend/linux/vulkan"
|
||||
download_and_extract "llama-$RELEASE-bin-ubuntu-x64.tar.gz" "$APP_DIR/llm-backend/linux/cpu"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user