Skip to content

fix(import): derive model name from selected GGUF for repo-root URIs#10589

Merged
mudler merged 1 commit into
mudler:masterfrom
Dennisadira:fix/import-name-from-gguf-10587
Jun 30, 2026
Merged

fix(import): derive model name from selected GGUF for repo-root URIs#10589
mudler merged 1 commit into
mudler:masterfrom
Dennisadira:fix/import-name-from-gguf-10587

Conversation

@Dennisadira

Copy link
Copy Markdown
Contributor

What

Fixes #10587.

When importing a HuggingFace GGUF model from a repository-root URI (no file component, e.g. hf://owner/repo) with the Model Name field left blank, the importer named the model after the repository (filepath.Base(details.URI)) instead of the GGUF file it actually selected from the repo listing. The emitted name:, the model: path, and the gallery Filename directory all inherited the repo name rather than the model.

Fix

  • Track whether the user supplied an explicit name (nameProvided); the URI base is now only a fallback.
  • In the HuggingFace branch, once the preferred model group is picked, re-derive the name from the selected GGUF via a new modelNameFromShardGroup helper that uses ShardGroup.Base minus the .gguf extension.
    • For sharded models this yields a clean logical name (e.g. Qwen3-30B-A3B-Q4_K_M) rather than a shard filename like ...-00001-of-00002.
    • For single-file repos it's the file basename minus extension.
  • An explicit name preference still always wins. The .gguf / URL / OCI import paths are unchanged.

Tests

  • New network-free unit specs in llama-cpp_test.go: name-from-single-GGUF, clean-name-from-shard-base, and explicit-name precedence.
  • Updated the live integration specs in importers_test.go that had encoded the previous repo-name behaviour to assert the GGUF-derived name.

All importer specs pass; go vet and gofmt clean.

🤖 Generated with Claude Code

When importing a HuggingFace GGUF model from a repository-root URI (no file
component, e.g. hf://owner/repo) with the Model Name field left blank, the
importer named the model after the repository (filepath.Base(details.URI))
instead of the GGUF file it actually selected from the repo listing (issue
mudler#10587).

Track whether the user supplied an explicit name; the URI base is now only a
fallback. In the HuggingFace branch, once the model group is picked, re-derive
the name from the selected GGUF via a new modelNameFromShardGroup helper that
uses ShardGroup.Base minus the .gguf extension. For sharded models this yields
a clean logical name (e.g. Qwen3-30B-A3B-Q4_K_M) rather than a shard filename
like ...-00001-of-00002. An explicit name preference still always wins, and the
.gguf/URL/OCI paths are unchanged.

Add network-free unit specs covering name-from-GGUF, clean-name-from-shard-base,
and explicit-name precedence, and update the live integration specs that had
encoded the previous repo-name behaviour.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Adira Denis Muhando <dennisadira@gmail.com>
@mudler mudler merged commit 1a4f68e into mudler:master Jun 30, 2026
1 check passed
mudler added a commit that referenced this pull request Jun 30, 2026
…ing (#10589) (#10609)

PR #10589 changed repo-root HuggingFace URI imports to name the model after
the selected GGUF file rather than the repository. The Open Responses API
integration test still requested the old repo-derived name
("Qwen3-VL-2B-Instruct-GGUF"), so every request 404'd on an unknown model and
the suite has failed on master since 1a4f68e.

Update testModel to the name the importer now registers for the default
q4_k_m quant ("Qwen3-VL-2B-Instruct-Q4_K_M") so the specs resolve the model
again. The #10589 behaviour change is intentional; only the stale test needed
updating.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
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.

Import derives model name from URI repo root instead of selected GGUF file when URI lacks a file component

2 participants