Make model prefetching automatic in install/run scripts
install-local-gpu.sh and bring-up-local-gpu.sh now call prefetch-models.sh --sdxl (host-side download, all models including SDXL/inpaint, ~13GB) automatically rather than treating it as a manual DNS-troubleshooting step. install-local-gpu.sh drops back to the invoking user via sudo -u "$SUDO_USER" -H before running it, since that script itself runs as root and would otherwise leave downloaded files root-owned. Both call sites are non-fatal: a prefetch failure logs a warning and the container still starts, falling back to its own in-container download attempt. Updated README to match.
This commit is contained in:
+22
-3
@@ -170,12 +170,31 @@ else
|
||||
echo " Minimum driver version: 525"
|
||||
fi
|
||||
|
||||
# ── 6. Prefetch all AI models (host-side, outside Docker) ───────────────────
|
||||
# In-container DNS/network is unreliable on some hosts, so downloading on the
|
||||
# host up front (including SDXL/inpaint, ~13GB) is the default now rather
|
||||
# than a manual troubleshooting step. Best-effort: this script must finish
|
||||
# (and leave the GPU/Docker setup done) even if prefetch fails outright.
|
||||
# Run as the real invoking user, not root, so downloaded files (and any
|
||||
# `pip install --user` side effects) end up owned by that user — this script
|
||||
# itself is already running as root via the sudo re-exec above.
|
||||
echo ""
|
||||
echo "Prefetching AI models (this can take a while for SDXL, ~13GB)..."
|
||||
if [ -n "${SUDO_USER:-}" ]; then
|
||||
sudo -u "$SUDO_USER" -H "$REPO_DIR/prefetch-models.sh" --sdxl \
|
||||
|| echo "⚠ Model prefetch had failures (see above) — continuing anyway, the container will retry in-container."
|
||||
else
|
||||
"$REPO_DIR/prefetch-models.sh" --sdxl \
|
||||
|| echo "⚠ Model prefetch had failures (see above) — continuing anyway, the container will retry in-container."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=================================================="
|
||||
echo " Setup complete."
|
||||
echo " Start the app with: ./bring-up-local-gpu.sh"
|
||||
echo ""
|
||||
echo " If models fail to download inside the container (DNS/firewall"
|
||||
echo " blocked), fetch them on the host first instead:"
|
||||
echo " ./prefetch-models.sh"
|
||||
echo " Models are prefetched automatically by this script and by"
|
||||
echo " bring-up-local-gpu.sh on every start. If any failed above (no"
|
||||
echo " network, etc.), re-run manually any time:"
|
||||
echo " ./prefetch-models.sh --sdxl"
|
||||
echo "=================================================="
|
||||
|
||||
Reference in New Issue
Block a user