KBaba7/llama.cpp
0
1#!/bin/bash2set -euo pipefail3this=$(realpath "$0"); readonly this4cd "$(dirname "$this")"5shellcheck "$this"6 7if (( $# != 1 && $# != 2 )); then8 cat >&2 <<'EOF'9usage:10 ci-run.sh <tmp_dir> [<cache_dir>]11 12This script wraps ci/run.sh:13* If <tmp_dir> is a ramdisk, you can reduce writes to your SSD. If <tmp_dir> is not a ramdisk, keep in mind that total writes will increase by the size of <cache_dir>.14 (openllama_3b_v2: quantized models are about 30GB)15* Persistent model and data files are synced to and from <cache_dir>,16 excluding generated .gguf files.17 (openllama_3b_v2: persistent files are about 6.6GB)18* <cache_dir> defaults to ~/.cache/llama.cpp19EOF20 exit 121fi22 23cd .. # => llama.cpp repo root24 25tmp="$1"26mkdir -p "$tmp"27tmp=$(realpath "$tmp")28echo >&2 "Using tmp=$tmp"29 30cache="${2-$HOME/.cache/llama.cpp}"31mkdir -p "$cache"32cache=$(realpath "$cache")33echo >&2 "Using cache=$cache"34 35_sync() {36 local from="$1"; shift37 local to="$1"; shift38 39 echo >&2 "Syncing from $from to $to"40 mkdir -p "$from" "$to"41 rsync -a "$from" "$to" --delete-during "$@"42}43 44_sync "$(realpath .)/" "$tmp/llama.cpp"45_sync "$cache/ci-mnt/models/" "$tmp/llama.cpp/ci-mnt/models/"46 47cd "$tmp/llama.cpp"48bash ci/run.sh ci-out ci-mnt49 50_sync 'ci-mnt/models/' "$cache/ci-mnt/models/" --exclude='*.gguf' -P51 