fix: avoid re-downloading models already present in local store#641
fix: avoid re-downloading models already present in local store#641Pnkcaht wants to merge 2 commits intodocker:mainfrom
Conversation
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
Summary of ChangesHello @Pnkcaht, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant optimization to the model pulling process. By first checking the local store for existing models using their normalized references, the system can now efficiently bypass unnecessary network requests and re-downloads. This enhancement improves performance and reduces bandwidth consumption when a model is already available locally, streamlining the overall model management workflow. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- If
localModel.Config()fails, the current behavior aborts the pull entirely, whereas previously it would have proceeded to download; consider logging the error and falling back to the normal pull path instead of returning an error so a corrupt cache does not block retrieval. - The progress message
Using cached model: %scurrently usescfg.GetSize()as the interpolated value; consider including the normalized reference (and optionally the size) instead so the message clearly identifies which cached model is being used.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- If `localModel.Config()` fails, the current behavior aborts the pull entirely, whereas previously it would have proceeded to download; consider logging the error and falling back to the normal pull path instead of returning an error so a corrupt cache does not block retrieval.
- The progress message `Using cached model: %s` currently uses `cfg.GetSize()` as the interpolated value; consider including the normalized reference (and optionally the size) instead so the message clearly identifies which cached model is being used.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
The pull request introduces a performance optimization to avoid re-downloading models that are already present in the local cache. This is done by adding a fast-path check in PullModel. While this is a good optimization, the current implementation has a critical flaw: it prevents updates for models referenced by mutable tags (like :latest). If a model exists locally, it will be used without checking the registry for a newer version. This can lead to silently using stale models. My review includes a suggestion to limit this optimization to immutable, digest-based references to fix this issue while still gaining the performance benefit for applicable cases.
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
What I did
Related issue
docker model list, butdocker model runre-downloads #634Diagram
flowchart LR A[docker model run] --> B[normalize model ref] B --> C{model in local store?} C -->|yes| D[use cached model] C -->|no| E[pull from registry]