feat: download_models.py script for automating model downloads#1817
Open
gagewillette wants to merge 1 commit into
Open
feat: download_models.py script for automating model downloads#1817gagewillette wants to merge 1 commit into
gagewillette wants to merge 1 commit into
Conversation
Contributor
Reviewer's GuideAdds a standalone download_models.py script that ensures required ONNX models are present in a local models/ directory by creating the directory if needed, skipping existing files, and downloading missing ones with progress reporting and error handling. Flow diagram for download_models.py model download processflowchart TD
A[start download_models.py] --> B[main]
B --> C[os.makedirs MODELS_DIR]
C --> D[for each model in MODELS]
D --> E{dest file exists?}
E -- yes --> F[print Skipping]
F --> D
E -- no --> G[download]
G --> H[urllib.request.urlretrieve]
H --> I[print Saved to dest]
G --> J{Exception during download?}
J -- yes --> K[print ERROR]
K --> L{dest exists?}
L -- yes --> M[os.remove dest]
M --> N[sys.exit 1]
L -- no --> N
J -- no --> D
D --> O[print All models ready]
O --> P[end]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider adding basic CLI arguments (e.g., to select specific models, override the models directory, or force re-download) so the script can be reused in more flexible ways rather than being fully hard-coded.
- You may want to add a lightweight validation step (such as checking for non-zero file size or an expected minimum size) before skipping existing files, so corrupt or partial downloads don’t get silently reused.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding basic CLI arguments (e.g., to select specific models, override the models directory, or force re-download) so the script can be reused in more flexible ways rather than being fully hard-coded.
- You may want to add a lightweight validation step (such as checking for non-zero file size or an expected minimum size) before skipping existing files, so corrupt or partial downloads don’t get silently reused.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
This pull request adds a new script,
download_models.py, to automate downloading required model files into themodels/directory. The script checks if the files already exist, downloads them if needed, and provides progress feedback and error handling.Model management automation:
download_models.pyscript to automate downloading specified.onnxmodel files (GFPGANv1.4.onnxandinswapper_128_fp16.onnx) into themodels/directory, including progress reporting and error handling.Summary by Sourcery
New Features: