Repository navigation
fix: preserve nested pretrained model paths in local directories - #2450
Open
original4422 wants to merge 2 commits into
Open
original4422 wants to merge 2 commits into
original4422 wants to merge 2 commits into
Conversation
Author
|
Hi @abetlen, when convenient, could you review the nested local_dir model-path fix, or advise if changes are needed? This AI-assisted PR records 34 local test passes and five real CPU loading controls on d58b69e; the follow-up only adds the changelog PR reference. Cross-platform and GPU validation remain for CI. Thank you. |
This branch has not been deployed
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.
Summary
Llama.from_pretrained(filename="nested/model.gguf", local_dir="models")matches and resolves the nested file, then drops its directory when constructing the model path.Preserve the matched relative path for explicit local directories, including glob matches.
Add offline/online path-selection regressions, flat-directory and snapshot-cache controls, and an Unreleased changelog entry.
Evidence
77fbb5d. Real offline nested literal/glob loads fail at the basename-only path even though Hugging Face Hub returns an existing nested file.After: all 8 path tests pass. Real offline nested literal/glob, flat-directory and snapshot literal/glob loads each generate 2 tokens with the cached stories15M Q4_0 GGUF,
n_gpu_layers=0and networking disabled.make test: 34 passed, no skips, using existing cached model fixtures withHF_HUB_OFFLINE=1.make lint: Ruff checks and formatting pass for all 30 Python files.Validated on macOS arm64, Python 3.12.14, huggingface-hub 2.2.0 and bundled llama.cpp
f5e6915c2, built withGGML_NATIVE=OFFandGGML_ACCELERATE=ON.The full suite used the available native backends; the explicit loading probes used CPU layers only.
Online discovery is covered with bounded Hub stubs, not a live model download; cross-platform/GPU matrices remain for CI.
Implemented, reviewed and tested by an AI coding agent acting under the contributor's authorization.
Merge Danger
Door: two-way; reverting the path join restores the previous behavior.
Blast Radius: local-directory main-model loading; the matched relative path is retained without changing discovery, download calls or snapshot-cache resolution.