Skip to content

server: inherit model_info when creating from a remote model - #16972

Open
tenderdeve wants to merge 1 commit into
ollama:mainfrom
tenderdeve:fix/16891-inherit-remote-model-info
Open

tenderdeve wants to merge 1 commit into
ollama:mainfrom
tenderdeve:fix/16891-inherit-remote-model-info

Conversation

@tenderdeve

Copy link
Copy Markdown

Fixes #16891

Creating a model from a remote parent (e.g. FROM glm-5.2:cloud) only carried RemoteModel and RemoteHost into the new config. The parent's architecture, context length and embedding length were dropped, so /api/show and /api/tags returned an empty model_info for the derived model.

Integrations that read the context window from model_info (e.g. VSCode Copilot) then fall back to a short default (~32K), which breaks long-context use of any model created this way. Since ollama create is the only config path for those integrations, there's no workaround.

The remote branch in CreateHandler now loads the parent's stored config and inherits model_family, context_length and embedding_length, mirroring the inheritance already done for local parents. Explicit Info overrides still win.

Added TestCreateFromRemoteModelInheritsModelInfo, which fails on main (empty model_info) and passes with the change.

Deriving a model from a remote parent (e.g. FROM glm-5.2:cloud) only
copied RemoteModel and RemoteHost into the new config, dropping the
parent's architecture, context length, and embedding length. /api/show
and /api/tags then returned an empty model_info for the derived model,
so integrations that read the context window from model_info fell back
to a short default.

Load the parent's stored config in the remote branch and inherit those
fields, mirroring the existing inheritance for local parents.

This branch has not been deployed

No deployments
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.

ollama create does not inherit model_info from parent model — context_length is lost

1 participant