Skip to content

Fix model name normalization in run command#410

Closed
krissetto wants to merge 1 commit intodocker:mainfrom
krissetto:fix-needing-prefix-with-run-command
Closed

Fix model name normalization in run command#410
krissetto wants to merge 1 commit intodocker:mainfrom
krissetto:fix-needing-prefix-with-run-command

Conversation

@krissetto
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @krissetto, 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 crucial fix to the run command by implementing consistent model name normalization. Previously, there could be discrepancies in how model names were interpreted between the pull and run commands, leading to potential user confusion or errors. By applying a standardized normalization function, the system now ensures that a model pulled with a given name can be reliably run using the same or a logically equivalent name, significantly improving the predictability and robustness of the model interaction workflow. The change is thoroughly validated with new test cases covering a wide range of model naming conventions.

Highlights

  • Model Name Normalization: The run command now explicitly normalizes user-provided model names using the NormalizeModelName utility function from the pkg/inference/models package. This ensures that model names are processed consistently, regardless of user input format.
  • Consistency with Pull Command: This change guarantees that the run command uses the same model name resolution logic as the pull command. This prevents scenarios where a model pulled under a certain identifier might not be recognized when attempting to run it with a slightly different, yet semantically equivalent, user input.
  • Enhanced Test Coverage: Comprehensive unit tests have been added to validate the model name normalization. These tests cover various input formats, including simple names, names with tags, explicit namespaces, HuggingFace models, and registry-prefixed models, and also verify consistency between pull and run operations.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 correctly applies model name normalization in the run command, ensuring consistency with the pull command's behavior. The added tests are comprehensive and validate the new logic effectively. I've suggested a minor refactoring in one of the new tests to improve its clarity and remove some redundancy. Overall, this is a solid improvement.

Signed-off-by: Christopher Petito <chrisjpetito@gmail.com>
@krissetto krissetto force-pushed the fix-needing-prefix-with-run-command branch from 84fc03f to e7a45b9 Compare November 14, 2025 18:15
@ericcurtin
Copy link
Contributor

We are trying our best to apply these daemon side, so we don't have to normalize for every client request. Funnily enough on this branch if I purge all models:

#413

and do

docker model run smollm2 hello

it works...


// TestRunModelNameNormalization verifies that model names are normalized correctly
// in the run command to ensure consistency with how models are stored after pulling
func TestRunModelNameNormalization(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equals to this test, right?

return nil
}

model = dmrm.NormalizeModelName(model)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Have you found an error?
In the backend we resolve the model name to the model ID for doing inference, so in case of error I think we should apply normalization in the API layer

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this pr is no longer needed since things have changed in the backend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! I'm closing it then, thanks!

@ilopezluna ilopezluna closed this Nov 26, 2025
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.

3 participants