Fix build cache, DNS/model download, and AI Edit error handling

Build / pip layer fixes:
- Add BUILDID ARG to Dockerfile.gpu; pass from docker-compose.gpu.yml build args
  so pip layers can be force-busted without --no-cache:
    BUILDID=$(date +%s) docker compose -f docker-compose.gpu.yml up --build

Model download (DNS-blocked environments):
- Change HF model cache from named volume to ./data/hf_cache bind mount
  so models can be pre-downloaded on the host (no rebuild needed)
- Remove now-unused hf_model_cache named volume
- README: add iptables fix + huggingface-cli offline download instructions

Error handling improvements:
- ai_edit_region: catch ConnectError/Errno-3 → return 503 with exact fix commands
- _require_remote: give actionable message when local_gpu provider fails to load
- _build_provider: catch AttributeError (torch.xpu from wrong diffusers) not just ImportError
- local_diffusion.py: fix docstring to reflect <0.29.0 pin

https://claude.ai/code/session_01WVDg7amsy1TTtxvpku7bcM
This commit is contained in:
Claude
2026-06-14 00:14:34 +00:00
parent 59b26b6d5e
commit 11772e620c
6 changed files with 86 additions and 18 deletions
+11 -7
View File
@@ -62,14 +62,23 @@ services:
build:
context: .
dockerfile: Dockerfile.gpu
args:
# Increment BUILDID to force pip layers to re-run without full --no-cache:
# BUILDID=$(date +%s) docker compose -f docker-compose.gpu.yml up --build
BUILDID: ${BUILDID:-1}
container_name: editmaskwithai-gpu
ports:
- "${PORT:-3080}:8000"
volumes:
# Persistent project data
- ./data:/app/data
# HuggingFace model cache — keeps downloaded models across rebuilds (~5-20 GB)
- hf_model_cache:/root/.cache/huggingface
# HuggingFace model cache — bind mount so models can be pre-downloaded on the host.
# If container DNS is blocked, download on the host and the container picks them up:
# pip install huggingface-hub
# huggingface-cli download diffusers/stable-diffusion-xl-1.0-inpainting-0.1 \
# --cache-dir ./data/hf_cache
# To free disk space: rm -rf ./data/hf_cache
- ./data/hf_cache:/root/.cache/huggingface
# Scripts (for exec access)
- ./scripts:/scripts
environment:
@@ -136,8 +145,3 @@ services:
- 8.8.4.4
restart: unless-stopped
volumes:
hf_model_cache:
# Survives docker compose down; delete manually to free disk space:
# docker volume rm editmaskwithai_hf_model_cache