fix: bake GFPGAN weights outside the models/ volume mount - #15
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/refacer/weights/during the Docker build instead of/refacer/models/GFPGAN_MODEL_PATHenv var is set in the Dockerfile somodels.pyknows where to find them at runtimescripts/download_models.pygains a--destflag to support the alternate destinationmodels.pyfalls back tomodels/<filename>as beforeRoot cause
The Dockerfile downloaded
GFPGANv1.4.pthinto/refacer/models/at build time, butdocker-compose.ymlmounts./models:/refacer/modelsat 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 withERROR: 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.onnxstill comes from the./modelsvolume mount as before. No changes to docker-compose.yml or the user setup steps.Closes #12