-
Notifications
You must be signed in to change notification settings - Fork 17
Add support for modelFile generate via model providers model_url #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @avinashsingh77, 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 new capability to the Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a valuable feature for generating a modelfile directly from a Hugging Face model URL. The implementation is well-structured, primarily by leveraging the huggingface-cli tool. My review focuses on enhancing user experience, ensuring proper resource management, and improving code clarity. I've suggested making the <path> argument and the --model_url flag mutually exclusive to prevent user confusion, adding cleanup for temporary directories, refining output handling within the hfhub package, and simplifying test logic for better maintainability.
4f37fb2 to
fb50643
Compare
chlins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we abstract a generic interface for the download part, and then support different drivers or vendors? Because in addition to Hugging Face, there are also model hubs like ModelScope.
|
Make sense. What all model vendors do we plan to support to start with?
…On Wed, 19 Nov 2025 at 1:47 PM, Chlins Zhang ***@***.***> wrote:
***@***.**** commented on this pull request.
Can we abstract a generic interface for the download part, and then
support different drivers or vendors? Because in addition to Hugging Face,
there are also model hubs like ModelScope.
—
Reply to this email directly, view it on GitHub
<#329 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZR3OPKI24M24EMC26FQON335QRR7AVCNFSM6AAAAACLYFAAOKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTIOBRGM3TQMZSGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
1a81c96 to
6d7fb90
Compare
|
@chlins Implemented a provider interface and added providers for HuggingFace and ModelScope as suggested. Does it look okay now? |
@avinashsingh77 Great work! thanks for adding the provider interface with HuggingFace and ModelScope implementations. I'll take a look at the changes in a bit and share my thoughts. |
| flags.StringVarP(&generateConfig.Output, "output", "O", ".", "specify the output path of modelfilem, must be a directory") | ||
| flags.BoolVar(&generateConfig.IgnoreUnrecognizedFileTypes, "ignore-unrecognized-file-types", false, "ignore the unrecognized file types in the workspace") | ||
| flags.BoolVar(&generateConfig.Overwrite, "overwrite", false, "overwrite the existing modelfile") | ||
| flags.StringVar(&generateConfig.ModelURL, "model_url", "", "download model from a supported provider (HuggingFace: owner/repo or full URL, ModelScope: full URL)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flag name should align with other flags naming style, suggest to use model-url.
|
|
||
| // SupportsURL checks if this provider can handle the given model URL | ||
| // This enables automatic provider detection based on URL patterns | ||
| SupportsURL(url string) bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to use explicit statement for this part, such as by scheme provided by user, which is more simple and clear, e.g --model-url hf://meta-llama/Llama-3.3-70B-Instruct
| } | ||
|
|
||
| // NewRegistry creates a new provider registry with all available providers | ||
| func NewRegistry() *Registry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this registry can be a global singleton.
|
|
||
| // Create a temporary directory for downloading the model | ||
| // Clean up the temporary directory after the function returns | ||
| tmpDir, err := os.MkdirTemp("", "modctl-model-downloads-*") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to consider expose this temp dir to user? because in some limited environment, user may only have write access to specific dirs.
| } | ||
|
|
||
| // downloadFile downloads a single file from HuggingFace | ||
| func downloadFile(ctx context.Context, owner, repo, filename, destPath string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this method used?
| } | ||
|
|
||
| // downloadFile downloads a single file from ModelScope | ||
| func downloadFile(ctx context.Context, owner, repo, filename, destPath string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this method used?
This PR adds support for providing model_url to
modctl modelfile generateTests added, run output:
Closes #308