Repository navigation
Conversation
…ers' from_pretrained Llava15ChatHandler.from_pretrained and MTMDChatHandler.from_pretrained still list the repo through HfFileSystem, so with HF_HUB_OFFLINE=1 they raise OfflineModeIsEnabled even when the projector file is cached or already in local_dir. Use the cached snapshot or a populated local_dir, as Llama.from_pretrained does since abetlen#2396.
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.
#2396 made
Llama.from_pretrainedwork withHF_HUB_OFFLINE=1. The two chat-handlerfrom_pretrainedclassmethods have the same code and were not changed.Repro, two steps. First download the projector (online):
Then run the same call again with
HF_HUB_OFFLINE=1(for either handler, and also with a populatedlocal_dir):Actual on main:
huggingface_hub.errors.OfflineModeIsEnabled: Cannot reach https://huggingface.co/api/models/ggml-org/SmolVLM-256M-Instruct-GGUF, raised byHfFileSystem().ls(repo_id)before the cached file is looked at.Expected: the cached (or
local_dir) projector file is matched against the pattern and loaded, as inLlama.from_pretrained.Fix: in
Llava15ChatHandler.from_pretrainedandMTMDChatHandler.from_pretrained, whenhuggingface_hub.constants.HF_HUB_OFFLINEis set, list the files of a populatedlocal_dir, otherwise of the cached snapshot (snapshot_download(..., local_files_only=True)), instead of callingHfFileSystem. The online path is unchanged. The listing stays non-recursive, like the existinghffs.ls(repo_id)call.Behaviour change: offline, the pattern is matched only against files already on disk, so a pattern that is ambiguous online (
mmproj-*) resolves to the single cached file. This is the same asLlama.from_pretrainedsince #2396.Test: not included in the PR, since tests are usually removed from outside PRs here; a test (cached snapshot and populated
local_dir, both handlers) is available on request. On main it gives 4 failed (OfflineModeIsEnabled), with this change 4 passed;tests/test_llama_chat_format.py2 passed;ruff checkandruff format --checkpass. Resolution was also checked with the real cachedggml-org/SmolVLM-256M-Instruct-GGUFprojector, online and offline.Not run: loading the projector into a model (the mtmd load), the server tests.
The implementation and tests were written with AI assistance.