pantry/projects/github.com/ggerganov/llama.cpp/llama-fetch

59 lines
1.1 KiB
Text
Raw Normal View History

#!/bin/sh
set -e
test -n "$VERBOSE" && set -x
if test -f "$1"/VERSION && test $(cat "$1"/VERSION) = $2; then
exit
fi
if command -v git >/dev/null; then
GIT="tea git"
else
GIT=git
fi
mkdir -p "$1"
cd "$1"
tea gum format "# preparing for model fetch"
echo # spacer
if test -d trackers; then
$GIT -C trackers fetch origin
$GIT -C trackers reset --hard origin/master
else
$GIT clone "https://github.com/ngosang/trackerslist" trackers
fi
TRACKERS=$(grep -v '^#' "trackers/trackers_all.txt" | tr '\n' ',')
tea gum format <<EoMD
# downloading 4b quantized LLaMA (7B) model
models will be placed: \`$PWD\`
> this may take a a few minutes…
EoMD
# --dir is .. coz the torrent is prefixed with a LLaMA directory
tea aria2c \
--dir=.. \
--seed-time=0 \
--bt-tracker="$TRACKERS" \
--summary-interval=0 \
--check-integrity \
'magnet:?xt=urn:btih:FLWZABA5EDZXVC45YHEMX6W55O6S4HXK'
tea gum format "# finalizing model"
echo #spacer
tea +google.com/sentencepiece upgrade-model.py 7B tokenizer.model
rm 7B/ggml-model-q4_0.bin
mv 7B/ggml-model-q4_0.bin.tmp 7B/ggml-model-q4_0.bin
echo $2 > VERSION
tea gum format "# All done!"
echo #spacer