Skip to content

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

Open
Dennisadira wants to merge 1 commit into
mudler:masterfrom
Dennisadira:fix/import-name-from-gguf-10587
Open

fix(import): derive model name from selected GGUF for repo-root URIs#10589
Dennisadira wants to merge 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>
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

1 participant