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:
Claude
2026-06-18 17:47:18 +00:00
parent b4a790473c
commit 3f4a6b754c
3 changed files with 34 additions and 10 deletions
+4 -4
View File
@@ -11,7 +11,7 @@ git clone https://github.com/outis1one/editmaskwithai
cd editmaskwithai
# One-time setup: installs nvidia-container-toolkit, configures Docker,
# and sets up a permanent DNS fix so the container can download models.
# sets up a permanent DNS fix, and prefetches all AI models on the host.
chmod +x install-local-gpu.sh
./install-local-gpu.sh
@@ -22,7 +22,7 @@ chmod +x bring-up-local-gpu.sh
Open **http://localhost:3080**
**First startup downloads the AI model for your GPU (~13 GB, one time).** Models are cached in `./data/hf_cache/` and survive rebuilds.
**Models (~13 GB total, one time) download automatically on the host**, outside Docker — both scripts call `./prefetch-models.sh` for you, since in-container DNS is unreliable on some hosts. They're cached in `./data/hf_cache/` and `./data/models/`, and survive rebuilds.
---
@@ -163,7 +163,7 @@ EditmaskwithAI/
├── Dockerfile.gpu
├── install-local-gpu.sh # One-time GPU host setup
├── bring-up-local-gpu.sh # Start/stop the GPU container
├── prefetch-models.sh # Download AI models on the host (DNS-blocked workaround)
├── prefetch-models.sh # Download AI models on the host (called automatically; also runnable standalone)
└── .env.example
```
@@ -232,7 +232,7 @@ You can also pick a specific model per-edit from the Remove Background dialog's
**AI models not downloading (container DNS blocked)**
Easiest fix: download the models on the host instead of inside the container — they land in `./data/`, which is already bind-mounted into the container, so it picks them up with no rebuild:
`install-local-gpu.sh` and `bring-up-local-gpu.sh` already run this for you automatically on every start, so you normally don't need to think about it. If a model still didn't download (no network at the time, etc.), re-run it manually — it lands in `./data/`, which is already bind-mounted into the container, so it's picked up with no rebuild:
```bash
./prefetch-models.sh # SAM + U2Net + BEN2 + BiRefNet-HR (~1.5GB)