Add caching support to gpt and stable-diffusion. - annna - Annna the nice frien… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit a5defdc0144603b1c39bfbac8b31057ee2b597c3 | |
parent 4e5cb78d7021871cd8bd6e2081fbdb2062fcecdc | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sat, 4 Jan 2025 12:16:20 +0100 | |
Add caching support to gpt and stable-diffusion. | |
gpt down to 3s | |
Diffstat: | |
M gpt | 8 ++++++++ | |
M stable-diffusion | 8 ++++++++ | |
2 files changed, 16 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/gpt b/gpt | |
@@ -9,6 +9,14 @@ ggmlmodel="models/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf" | |
ggmlntokens="$((69 * 2))" | |
cd $ggmlbase | |
+if mountpoint -q /br/ai/tmp; | |
+then | |
+ ggmlbasename="$(basename "${ggmlmodel}")" | |
+ ggmltmppath="/br/ai/tmp/${ggmlbasename}" | |
+ [ ! -r "${ggmltmppath}" ] && cp "$ggmlmodel" /br/ai/tmp | |
+ [ -r "${ggmltmppath}" ] && ggmlmodel="${ggmltmppath}" | |
+fi | |
+ | |
prompt="$1" | |
printf "%s\n" "${prompt}" \ | |
| $ggmlbin -m $ggmlmodel -n $ggmlntokens \ | |
diff --git a/stable-diffusion b/stable-diffusion | |
@@ -14,6 +14,14 @@ sdnegative='nipples, busty, nude, lowres, (worst quality, lo… | |
outputf="${1}" | |
shift 1 | |
+if mountpoint -q /br/ai/tmp; | |
+then | |
+ sdbasename="$(basename "${sdmodel}")" | |
+ sdtmppath="/br/ai/tmp/${sdbasename}" | |
+ [ ! -r "${sdtmppath}" ] && cp "${sdmodel}" /br/ai/tmp | |
+ [ -r "${sttmppath}" ] && sdmodel="${sdtmppath}" | |
+fi | |
+ | |
${sdcmd} --type f16 -m ${sdmodel} -o "${outputf}" -p "$@" -n "${sdnegative}" >… | |
#${sdcmd} -m ${sdmodel} -o "${outputf}" -p "$@" -n "${sdnegative}" -v | |