Adding more models

This commit is contained in:
Matthias Ladkau
2026-09-30 09:03:46 +02:00
parent 009a8f52a9
commit 3b0f82ecfa
2 changed files with 20 additions and 5 deletions
+12 -2
View File
@@ -132,9 +132,12 @@ echo
# ------------------------------------------------ memory budget / context
# What a model must fit into: VRAM when a GPU is used, else RAM minus headroom
# for the OS, aider and the editor.
# for the OS, aider and the editor. hard_budget/gpu_hard have almost no headroom -
# a model only fitting there is "tight" (usable, but close other apps first).
budget=$(awk -v r="$ram_gb" 'BEGIN {b=r-4; if (b<1) b=1; printf "%.1f", b}')
hard_budget=$(awk -v r="$ram_gb" 'BEGIN {b=r-1; if (b<1) b=1; printf "%.1f", b}')
gpu_budget=$(awk -v v="$vram_gb" 'BEGIN {printf "%.1f", v*0.9}')
gpu_hard=$(awk -v v="$vram_gb" 'BEGIN {printf "%.1f", v*0.98}')
if awk -v b="$budget" 'BEGIN{exit !(b<6)}'; then CONTEXT=4096
elif awk -v b="$budget" 'BEGIN{exit !(b>=40)}'; then CONTEXT=32768
@@ -148,10 +151,14 @@ for i in "${!rows[@]}"; do
IFS=$'\t' read -r tag disk mem cpu_ok rank desc <<<"${rows[$i]}"
tags[i]=$tag
fits_ram=$(awk -v m="$mem" -v b="$budget" 'BEGIN{print (m<=b)}')
fits_hard_ram=$(awk -v m="$mem" -v b="$hard_budget" 'BEGIN{print (m<=b)}')
fits_gpu=$(awk -v m="$mem" -v b="$gpu_budget" -v u="$gpu_usable" 'BEGIN{print (u && m<=b)}')
fits_hard_gpu=$(awk -v m="$mem" -v b="$gpu_hard" -v u="$gpu_usable" 'BEGIN{print (u && m<=b)}')
if [ "$fits_gpu" = 1 ]; then status[i]="fits"; speed[i]="fast (GPU)"
elif [ "$fits_hard_gpu" = 1 ]; then status[i]="tight"; speed[i]="tight (GPU)"
elif [ "$fits_ram" = 1 ] && [ "$cpu_ok" = yes ]; then status[i]="fits"; speed[i]="ok (CPU)"
elif [ "$fits_ram" = 1 ]; then status[i]="slow"; speed[i]="slow (CPU)"
elif [ "$fits_hard_ram" = 1 ]; then status[i]="tight"; speed[i]="tight (CPU)"
else status[i]="too big"; speed[i]="-"; fi
[ "${status[$i]}" = fits ] && rec=$i # sorted by rank, so last "fits" wins
done
@@ -211,7 +218,10 @@ if [ -z "$FORCE_MODEL" ]; then
[[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 1 ] && [ "$choice" -le "${#rows[@]}" ] || { echo "Invalid choice." >&2; exit 1; }
sel=$((choice-1))
MODEL=${tags[$sel]}
if [ "${status[$sel]}" = "too big" ] || [ "${status[$sel]}" = "slow" ]; then
if [ "${status[$sel]}" = "tight" ]; then
echo "Warning: $MODEL is 'tight' on this machine (fits, but leaves little headroom - close other apps first)."
if [ "$ASSUME_YES" != 1 ]; then read -r -p "Continue anyway? [y/N] " a; [[ "$a" =~ ^[Yy] ]] || exit 1; fi
elif [ "${status[$sel]}" = "too big" ] || [ "${status[$sel]}" = "slow" ]; then
echo "Warning: $MODEL is '${status[$sel]}' on this machine (may swap, crawl, or crash)."
if [ "$ASSUME_YES" != 1 ]; then read -r -p "Continue anyway? [y/N] " a; [[ "$a" =~ ^[Yy] ]] || exit 1; fi
fi