Skip to content

fix: bake GFPGAN weights outside the models/ volume mount - #15

Merged
strbck merged 1 commit into
mainfrom
fix/gfpgan-docker-volume-shadow
May 13, 2026
Merged

fix: bake GFPGAN weights outside the models/ volume mount#15
strbck merged 1 commit into
mainfrom
fix/gfpgan-docker-volume-shadow

Conversation

@strbck

@strbck strbck commented May 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • GFPGAN weights are now downloaded to /refacer/weights/ during the Docker build instead of /refacer/models/
  • GFPGAN_MODEL_PATH env var is set in the Dockerfile so models.py knows where to find them at runtime
  • scripts/download_models.py gains a --dest flag to support the alternate destination
  • Local (non-Docker) installs are unaffected: the env var is unset, so models.py falls back to models/<filename> as before

Root cause

The Dockerfile downloaded GFPGANv1.4.pth into /refacer/models/ at build time, but docker-compose.yml mounts ./models:/refacer/models at runtime. Docker's bind mount completely shadows the directory, so the pre-downloaded weights were invisible to the running container — causing it to exit immediately with ERROR: Model not found: GFPGANv1.4.pth.

Reviewer notes

The only behavioural change in Docker is where GFPGAN weights are loaded from (/refacer/weights/ vs /refacer/models/). inswapper_128.onnx still comes from the ./models volume mount as before. No changes to docker-compose.yml or the user setup steps.

Closes #12

The Dockerfile was downloading GFPGANv1.4.pth into /refacer/models/
at build time, but the docker-compose volume mount
./models:/refacer/models replaced that directory at runtime, shadowing
the pre-downloaded weights and causing the container to exit with
"Model not found: GFPGANv1.4.pth".

Fix: download GFPGAN weights to /refacer/weights/ (a path that is never
volume-mounted) and point models.py to that location via a
GFPGAN_MODEL_PATH env var set in the Dockerfile. For local (non-Docker)
installs the env var is unset and the existing models/ fallback is used,
so there is no change to the local setup path.

Also adds a --dest flag to scripts/download_models.py to support the
alternate destination.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@strbck
strbck merged commit 9e28623 into main May 13, 2026
1 check passed
@strbck
strbck deleted the fix/gfpgan-docker-volume-shadow branch May 13, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refacer expects GFPGANv1.4.pth in models/ even on container build

1 participant