fix(import): strip file:// scheme from model path for local imports#10599
Open
Dennisadira wants to merge 1 commit into
Open
fix(import): strip file:// scheme from model path for local imports#10599Dennisadira wants to merge 1 commit into
Dennisadira wants to merge 1 commit into
Conversation
Importing a model from a local directory (e.g. a HuggingFace checkout or an LM Studio store) via a file:// URI produced a config whose model field kept the scheme verbatim, e.g. model: file:///Users/u/.../Qwen3-4bit. The mlx and vllm backends treat that field as a HuggingFace repo id or local path and reject the file:// form with "Repo id must be in the form 'repo_name' or 'namespace/repo_name'", so the model imported fine but failed to load (issue mudler#7461). Add a shared LocalModelPath helper that reduces a file:// URI to the bare filesystem path it points at and leaves HuggingFace/HTTP URIs untouched, and route the mlx, vllm, transformers and diffusers importers (all of which pass details.URI straight into the model field for from_pretrained-style loading) through it. Cover the helper directly plus end-to-end file:// import specs for the mlx and vllm importers. Assisted-by: Claude:claude-opus-4-8 [Claude Code] Signed-off-by: Adira Denis Muhando <dennisadira@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #7461.
Importing a model from a local directory (a HuggingFace checkout, or an LM Studio store) via a
file://URI produced a config whosemodel:field kept the scheme verbatim:The model imported fine, but loading failed because the
mlxandvllmbackends treatmodel:as a HuggingFace repo id or local path and reject thefile://form:Both
mlxandvllmwere reported (vllm in the issue comments).Fix
LocalModelPathhelper (core/gallery/importers/helpers.go) that reduces afile://URI to the bare filesystem path it points at, and leaves HuggingFace/HTTP URIs untouched.details.URIstraight into themodel:field forfrom_pretrained-style loading through it: mlx, vllm, transformers, diffusers (the latter two share the identical pattern, so fixing them here heads off the same report for those backends).Absolute (
file:///abs) and relative (file://rel) local URIs both normalize correctly; remote URIs are unchanged, so the existing remote-load path and its tests are untouched.Tests
LocalModelPath(absolute, relative, HF/HTTP passthrough).file://import specs for the mlx and vllm importers asserting the emittedmodel:no longer carries the scheme.All importer specs pass;
go vetandgofmtclean.🤖 Generated with Claude Code