Fix: Pass local_files_only from pipeline() to model loading#42318
Fix: Pass local_files_only from pipeline() to model loading#42318Rocketknight1 merged 12 commits intohuggingface:mainfrom
Conversation
|
Branch updated to sync with main. I verified this locally by clearing the Hugging Face cache and running a test script:
The CI failure in |
Wauplin
left a comment
There was a problem hiding this comment.
Looks good to me, thanks for fixing this!
(might be good to add a test in ./tests/test_pipeline_mixin.py? -let's wait for a review from a transformers's maintainer :) -)
|
This PR makes sense to me! One question - can you check in the PEFT path, to see if we need to pass this there too? I'm not sure if the adapter-loading path will respect |
e833ed5 to
385c690
Compare
You're actually right. made some changes and PTAL. |
|
There's a lot of unrelated style changes here! Can you |
4ee4804 to
7630509
Compare
| from peft.utils.hotswap import ( | ||
| check_hotswap_configs_compatible, | ||
| hotswap_adapter_from_state_dict, | ||
| ) |
There was a problem hiding this comment.
Still a lot of unrelated style changes, sorry! Can you check against main and revert the unrelated changes that are just style like this? Most good IDEs have git compare/diff functions that should make it easy enough to do, but doing it manually shouldn't take too long either.
706a52f to
ec259f7
Compare
| local_files_only = kwargs.get("local_files_only", False) | ||
|
|
||
| hub_kwargs = { | ||
| "revision": revision, | ||
| "token": token, | ||
| "trust_remote_code": trust_remote_code, | ||
| "_commit_hash": commit_hash, | ||
| "local_files_only": local_files_only, |
There was a problem hiding this comment.
Hey, I see the review ping but there's still lots of style issues! If you look at the diff, everything in __init__.py except this section is just style changes.
There was a problem hiding this comment.
Done. Every other styling change was done by ruff.
|
@bot /style |
|
Style bot fixed some files and pushed the changes. |
|
There are some CI issues, not the fault of this PR! Hold on for a day or two and we'll resolve them, then ping me to rerun tests |
Hey! Is the CI issues sorted? |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
…ace#42318) * Fix: Propagate local_files_only to hub_kwargs and PEFT adapter loading * Fix conflicts and code style * Apply formatting fixes * Apply style fixes * Fix style: Apply minimal changes for local_files_only * Style: Revert formatting and finalize local_files_only fix in __init__.py * Apply style fixes * Trigger tests --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Matt <Rocketknight1@users.noreply.github.com> Co-authored-by: Matt <rocketknight1@gmail.com>
Fixes #42269
Fixes a bug where passing
local_files_only=Truetopipeline()was ignored, causing models to download from the Hub even when offline mode was explicitly requested.The Fix:
The
local_files_onlyargument was being extracted fromkwargsbut was missing from thehub_kwargsdictionary thatpipeline()uses to configure downloads. This PR adds the flag tohub_kwargs, ensuring it is correctly propagated toAutoConfig.from_pretrainedandload_model.Reproduction & Verification
I verified this locally by clearing the cache for a specific model (
hf-internal-testing/tiny-random-bert) and attempting to load it viapipeline()withlocal_files_only=True.OSError(because the model is not locally available), confirming that no connection to the Hub was attempted.Before submitting
Who can review?
@Rocketknight1 (Pipelines)