gpt - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
gpt (1220B) | |
--- | |
1 #!/bin/sh | |
2 | |
3 #ggmlbase="/br/ai/ggml" | |
4 ggmlbase="/br/ai/llama.cpp" | |
5 #ggmlbin="./build/bin/gpt-2" | |
6 ggmlbin="./build/bin/llama-cli" | |
7 #ggmlmodel="models/gpt-2-1558M/ggml-model.bin" | |
8 ggmlmodel="models/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf" | |
9 ggmlntokens="$((69 * 2))" | |
10 | |
11 cd $ggmlbase | |
12 if mountpoint -q /br/ai/tmp; | |
13 then | |
14 ggmlbasename="$(basename "${ggmlmodel}")" | |
15 ggmltmppath="/br/ai/tmp/${ggmlbasename}" | |
16 [ ! -r "${ggmltmppath}" ] && cp "$ggmlmodel" /br/ai/tmp | |
17 [ -r "${ggmltmppath}" ] && ggmlmodel="${ggmltmppath}" | |
18 fi | |
19 | |
20 prompt="$1" | |
21 if [ -z "$prompt" ]; | |
22 then | |
23 cat \ | |
24 | $ggmlbin -m $ggmlmodel -n $ggmlntokens -t 3 \ | |
25 --no-warmup --simple-io --no-display-prompt --gr… | |
26 -cnv 2>/dev/null \ | |
27 | sed -E '/^$/d;s/^>[[:blank:]]+//;q' | |
28 else | |
29 printf "%s\n" "${prompt}" \ | |
30 | $ggmlbin -m $ggmlmodel -n $ggmlntokens -t 3 \ | |
31 --no-warmup --simple-io --no-display-prompt --gr… | |
32 -cnv 2>/dev/null \ | |
33 | sed -E '/^$/d;s/^>[[:blank:]]+//;q' | |
34 fi | |
35 #$ggmlbin -m $ggmlmodel -n $ggmlntokens \ | |
36 # --simple-io --no-display-prompt --grammar 'root ::= ([^\x00-\x1… | |
37 # -p "$1" 2>/dev/null \ | |
38 # | head -n1 \ | |
39 # | sed -E 's/^[[:blank:]]+//;s/[[:blank:]]*\[end of text\]$//' \ | |
40 # | tr -d '"' | |
41 |