This commit is contained in:
Max Howell 2023-03-29 09:33:17 -04:00
parent f8b769911a
commit e9e9278248
3 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,19 @@
#!/bin/sh
set -e
test -n "$VERBOSE" && set -x
D="$(cd "$(dirname "$0")"/.. && pwd)"
VERSION="$(basename "$D")"
MODEL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/models"
export PATH="$D/tbin:$PATH"
gpt4all-fetch-model "$MODEL_DIR" "$VERSION"
if test "$1" != '--fetch'; then
exec "$D"/tbin/gpt4all \
--color \
--model "$MODEL_DIR"/gpt4all-lora-quantized.bin \
"$@"
fi

View file

@ -0,0 +1,59 @@
#!/bin/sh
set -e
test -n "$VERBOSE" && set -x
if test -f "$1"/gpt4all-lora-quantized.bin.VERSION && test $(cat "$1"/gpt4all-lora-quantized.bin.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
URL='magnet:?xt=urn:btih:1F11A9691EE06C18F0040E359361DCA0479BCB5A&dn=gpt4all-lora-quantized.bin&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce'
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 model
model will be placed: \`$PWD\`
> this may take a a few minutes…
EoMD
CHECK=""
if test -f gpt4all-lora-quantized.bin; then
# only add this if file exists sine otherwise spurious (non-fatal) error message is shown
CHECK="--check-integrity"
# else
# the above torrent is not seeded yet
#URL="https://s3.amazonaws.com/static.nomic.ai/gpt4all/models/gpt4all-lora-quantized.bin"
fi
tea aria2c \
--dir=. \
--seed-time=0 \
--bt-tracker="$TRACKERS" \
--summary-interval=0 \
$CHECK \
"$URL"
echo $2 > gpt4all-lora-quantized.bin.VERSION
tea gum format "# All done!"
echo #spacer

View file

@ -0,0 +1,26 @@
distributable:
url: https://github.com/zanussbaum/gpt4all.cpp/archive/41e992905c4de16b0071338caeb730923323c5f9.tar.gz
strip-components: 1
versions:
- 2023.03.29
provides:
- bin/gpt4all
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
script: |
mkdir -p {{prefix}}/bin {{prefix}}/tbin
make chat
mv chat {{prefix}}/tbin/gpt4all
mv props/gpt4all {{prefix}}/bin
mv props/gpt4all-fetch-model {{prefix}}/tbin
test: |
{{prefix}}/tbin/gpt4all --help
# testing more than this requires downloading the models 😬