Wire GPU-aware image gen into setup: auto-install, precision, ComfyUI

Previously display-only: IMG_TIER/IMG_MODELS were detected but never
used. Now they drive actual behavior:

- Both setup scripts call setup-image-models.sh --auto after model
  pulls, installing the right SD/SDXL/Flux model for the detected GPU
- INVOKEAI_PRECISION is now GPU-aware: bfloat16 for Ampere+ (compute
  8.0+), float16 for Pascal+, auto fallback for older cards. Was
  hardcoded to float16.
- local-ai-setup.sh now includes ComfyUI service + Open WebUI
  integration (ENABLE_IMAGE_GENERATION=true, COMFYUI_BASE_URL) — was
  completely missing, only laptop_full_setup.sh had it
- Added ComfyUI port 8188 to UFW firewall rules in local-ai-setup.sh
- Added comfyui-data/comfyui-output directories to mkdir loop
- Updated start.sh and final output to show ComfyUI URL

https://claude.ai/code/session_01PtYTPherSJaxDEVPgF6Nxu
This commit is contained in:
Claude
2026-03-22 21:33:25 +00:00
parent 8cc849290a
commit 7ffd012a3a
2 changed files with 79 additions and 6 deletions
+29 -1
View File
@@ -105,6 +105,19 @@ else
IMG_DEFAULT=""
fi
# ── InvokeAI precision (GPU-aware) ───────────────────────────────────────────
# Ampere+ (compute 8.0+) supports bfloat16 natively for better precision.
# All modern NVIDIA GPUs support float16. Fall back to auto if unsure.
GPU_COMPUTE=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null \
| head -1 | tr -d '.' || echo "0")
if [[ "$GPU_COMPUTE" -ge 80 ]]; then
INVOKEAI_PRECISION="bfloat16" # Ampere+ (RTX 30xx/40xx/50xx, A-series, H100)
elif [[ "$GPU_COMPUTE" -ge 60 ]]; then
INVOKEAI_PRECISION="float16" # Pascal+ (GTX 10xx, RTX 20xx, Tesla P40/V100)
else
INVOKEAI_PRECISION="auto" # Let InvokeAI decide
fi
# ── new vs update ─────────────────────────────────────────────────────────────
IS_UPDATE=false
[[ -f "$BASE/docker-compose.yml" ]] && IS_UPDATE=true
@@ -1179,7 +1192,7 @@ IMGENV
environment:
- INVOKEAI_HOST=0.0.0.0
- INVOKEAI_PORT=9090
- INVOKEAI_PRECISION=float16
- INVOKEAI_PRECISION=$INVOKEAI_PRECISION
deploy:
resources:
reservations:
@@ -1470,6 +1483,21 @@ elif $INSTALL_AI; then
info "Skipping model pull — run later: bash $BASE/pull-models.sh"
fi
# ── Install image generation base model (GPU-aware) ──────────────────────────
if $INSTALL_AI && ($SVC_INVOKEAI || $SVC_COMFYUI) && $PULL_MODELS; then
section "Image Generation Models"
info "GPU: ${TOTAL_VRAM}GB VRAM → $IMG_TIER"
if [[ -n "$IMG_DEFAULT" ]]; then
info "Auto-installing recommended model: $IMG_DEFAULT"
info "Supported on your GPU: $IMG_MODELS"
bash "$SCRIPT_DIR/setup-image-models.sh" --auto
else
warn "Not enough VRAM for image generation models (need at least 4GB)"
fi
elif $INSTALL_AI && ($SVC_INVOKEAI || $SVC_COMFYUI); then
info "Skipping image model install — run later: bash $SCRIPT_DIR/setup-image-models.sh"
fi
# ── Start ZIM downloads (answer was captured upfront) ────────────────────────
if $SVC_KIWIX && [[ "$ZIM_CHOICE" != "3" ]]; then
section "Starting ZIM Downloads"