Add GPU-aware image model detection and setup-image-models.sh

- Both setup scripts now detect VRAM and determine which image gen
  models the GPU can run (SD 1.5 at 4GB, SDXL at 8GB, Flux at 12-20GB)
- New setup-image-models.sh: interactive script that detects GPU,
  shows available models with VRAM requirements, and installs into
  InvokeAI and/or ComfyUI. Supports --auto for unattended install.
- Scales from 4GB cards through dual RTX 5000s to high-end 48GB cards
- README: added image gen VRAM tier table, expanded inpainting docs
  with practical fix recipes (hands, fingers, eyes, backgrounds),
  mask tips, and denoising strength guidance
- Setup end messages now show image gen capabilities and point to
  setup-image-models.sh instead of manual model install instructions

https://claude.ai/code/session_01PtYTPherSJaxDEVPgF6Nxu
This commit is contained in:
Claude
2026-03-22 21:23:28 +00:00
parent da75be9ae6
commit 8cc849290a
4 changed files with 397 additions and 14 deletions
+42 -8
View File
@@ -80,6 +80,31 @@ else
CTX=4096; OLLAMA_KV_CACHE="q4_0"; GPU_TIER="CPU only — 4B models (slow)"
fi
# ── Image generation model tiers (VRAM-aware) ────────────────────────────────
# Image gen shares GPU with Ollama — Ollama unloads after KEEP_ALIVE timeout,
# so image gen gets full VRAM when Ollama is idle.
if [[ "$TOTAL_VRAM" -ge 24 ]]; then
IMG_MODELS="SD 1.5, SDXL, SDXL Turbo, Flux.1-dev, Flux.1-schnell"
IMG_TIER="all models including Flux"
IMG_DEFAULT="SDXL"
elif [[ "$TOTAL_VRAM" -ge 12 ]]; then
IMG_MODELS="SD 1.5, SDXL, SDXL Turbo, Flux.1-schnell (tight)"
IMG_TIER="SDXL + Flux-schnell"
IMG_DEFAULT="SDXL"
elif [[ "$TOTAL_VRAM" -ge 8 ]]; then
IMG_MODELS="SD 1.5, SDXL (tight at 512px), SDXL Turbo"
IMG_TIER="SD 1.5 comfortable, SDXL possible"
IMG_DEFAULT="SD 1.5"
elif [[ "$TOTAL_VRAM" -ge 4 ]]; then
IMG_MODELS="SD 1.5 (float16)"
IMG_TIER="SD 1.5 only"
IMG_DEFAULT="SD 1.5"
else
IMG_MODELS="none (CPU generation extremely slow)"
IMG_TIER="CPU only — not recommended"
IMG_DEFAULT=""
fi
# ── new vs update ─────────────────────────────────────────────────────────────
IS_UPDATE=false
[[ -f "$BASE/docker-compose.yml" ]] && IS_UPDATE=true
@@ -95,6 +120,7 @@ echo ""
info "Machine : $(hostname)"
info "LAN IP : $LOCAL_IP"
info "GPU : ${GPU_NAME} (${VRAM_GB}GB VRAM)"
info "Image : $IMG_TIER"
$IS_UPDATE && warn "Existing install found. Config files kept unless --force is passed."
# ── Q1: Top-level — what to run ───────────────────────────────────────────────
@@ -1596,23 +1622,31 @@ if $INSTALL_AI; then
echo " → Auto-summarizes old messages when context fills up (like Claude)"
echo " Auto Memory: Install from Admin → Functions → Discover → search 'Auto Memory'"
echo " → Automatically stores relevant info as persistent memories across chats"
($SVC_COMFYUI || $SVC_INVOKEAI) && {
echo ""
echo -e " ${YELLOW}Image Generation — GPU: ${TOTAL_VRAM}GB → $IMG_TIER${NC}"
echo " Install base models (detects your GPU automatically):"
echo " ./setup-image-models.sh # interactive"
echo " ./setup-image-models.sh --auto # install recommended default"
echo " Supports: $IMG_MODELS"
}
$SVC_COMFYUI && {
echo ""
echo -e " ${YELLOW}Image Generation (ComfyUI → Open WebUI):${NC}"
echo " ComfyUI is pre-configured. To complete setup:"
echo " 1. Open ComfyUI at http://$LOCAL_IP:8188 and install a model (e.g. SD 1.5, SDXL)"
echo -e " ${YELLOW}ComfyUI → Open WebUI (chat-integrated image gen):${NC}"
echo " 1. Run ./setup-image-models.sh to install a base model"
echo " 2. In ComfyUI: Settings (gear) → enable 'Dev Mode' → Save workflow as 'API Format'"
echo " 3. In Open WebUI: Admin → Settings → Images"
echo " Engine: ComfyUI | URL: http://comfyui:8188 (already set via env vars)"
echo " 4. Import your workflow JSON and map the prompt/output nodes"
echo " 5. Ask any model to 'generate an image of...' — it will use ComfyUI"
}
$SVC_INVOKEAI && ! $SVC_COMFYUI && {
$SVC_INVOKEAI && {
echo ""
echo -e " ${YELLOW}Image Generation (InvokeAI standalone):${NC}"
echo " InvokeAI runs at http://$LOCAL_IP:9090 with its own UI"
echo " Note: InvokeAI does NOT integrate with Open WebUI natively"
echo " For Open WebUI integration, enable ComfyUI in the setup wizard"
echo -e " ${YELLOW}InvokeAI (standalone UI — inpainting, img2img, LoRA):${NC}"
echo " InvokeAI runs at http://$LOCAL_IP:9090"
echo " For inpainting: Unified Canvas tab → brush over area → describe replacement"
echo " Import LoRAs: ./invokeai-import-lora.sh <file.safetensors>"
$SVC_COMFYUI || echo " For Open WebUI chat integration, enable ComfyUI in the setup wizard"
}
fi
if $SVC_KIWIX && [[ "$ZIM_CHOICE" == "3" ]]; then