-
Notifications
You must be signed in to change notification settings - Fork 31.2k
Fix: Pass local_files_only from pipeline() to model loading #42318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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)