Skip to content

Fix model namespace normalization for locally packaged models#42

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-local-model-error
Draft

Fix model namespace normalization for locally packaged models#42
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-local-model-error

Conversation

Copy link
Copy Markdown

Copilot AI commented Oct 19, 2025

Problem

When users packaged a local GGUF model without specifying a namespace, the model could not be run afterward. This occurred because the model name was not normalized during packaging, causing a mismatch between the stored name and the name used during lookup.

For example:

docker model package --gguf /path/to/output/gemma-3-270m-it.F16.gguf my-model
# Model loaded successfully

docker model list
# Shows: my-model (without ai/ prefix)

docker model run my-model
# Error: Failed to inspect model: invalid model name: my-model:latest

The root cause was that:

  1. The package command stored the model without normalizing the name (e.g., as my-model)
  2. The run command normalized my-model to ai/my-model:latest before lookup
  3. The lookup failed because ai/my-model:latest didn't match the stored name

Solution

This PR ensures that model names are normalized to include the default ai/ namespace before being stored, making the behavior consistent across all operations. Now my-model becomes ai/my-model:latest during packaging, which matches what all other commands expect.

Changes

  • cmd/cli/commands/package.go: Added model name normalization before creating tags in newModelRunnerTarget()
  • cmd/cli/commands/tag.go: Added target model name normalization before creating tags in tagModel()
  • cmd/cli/commands/utils_test.go: Added test to verify normalization consistency for locally packaged models

Result

The workflow now works seamlessly:

docker model package --gguf /path/to/model.gguf my-model
# Model is stored as: ai/my-model:latest

docker model list
# Shows: ai/my-model:latest

docker model run my-model
# Normalizes to ai/my-model:latest and runs successfully!

This ensures that ai/ is the default namespace in all cases, as intended by the original design.

Fixes issue where locally packaged models without explicit namespaces could not be run.

Original prompt

This section details on the original issue you should resolve

<issue_title>Bug related to running locally packaged/loaded model</issue_title>
<issue_description>I've recently fine-tuned a local model and packaged/loaded the GGUF model. That model name didn't have a namespace associated with it, as I had no intent of pushing the model. However, when attempting to run the model, it failed with an error indicating the model name was invalid (screenshot below).

Image

cc @ericcurtin </issue_description>

<agent_instructions>"ai/" should be the default namespace in all cases.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes docker#250


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 19, 2025 11:25
Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bug related to running locally loaded model Fix model namespace normalization for locally packaged models Oct 19, 2025
Copilot AI requested a review from ericcurtin October 19, 2025 11:29
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.

Bug related to running locally packaged/loaded model

2 participants