Fix: Pass local_files_only from pipeline() to model loading
Author: nandan2003
Pull request: yes

Fixes #42269

Fixes a bug where passing `local_files_only=True` to `pipeline()` was ignored, causing models to download from the Hub even when offline mode was explicitly requested.

**The Fix:**
The `local_files_only` argument was being extracted from `kwargs` but was missing from the `hub_kwargs` dictionary that `pipeline()` uses to configure downloads. This PR adds the flag to `hub_kwargs`, ensuring it is correctly propagated to `AutoConfig.from_pretrained` and `load_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 via `pipeline()` with `local_files_only=True`.

* **Before Fix:** The model would download despite the flag.
* **After Fix:** The call correctly raises an `OSError` (because the model is not locally available), confirming that no connection to the Hub was attempted.

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request), Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Yes, issue #42269.
- [ ] Did you make sure to update the documentation with your changes? (Bug fix, no docs needed).
- [x] Did you write any new necessary tests? (Verified manually via reproduction script).

## Who can review?

@Rocketknight1 (Pipelines)

Comments:
Branch updated to sync with main.

I verified this locally by clearing the Hugging Face cache and running a test script:
1. **Before:** `pipeline(..., local_files_only=True)` triggered a download.
2. **After:** It correctly raises `OSError` (indicating offline mode is respected).

The CI failure in `tests_processors` appears unrelated to these changes in `pipelines/__init__.py`.

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 `local_files_only` either.

> 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 `local_files_only` either.

You're actually right. made some changes and PTAL.

There's a lot of unrelated style changes here! Can you `pip install -e .[quality]` to make sure you're using the right versions of the style tools, then `make style` or `make fixup`? That should reduce the size of the diff a lot.

@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

> 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](https://moon-ci-docs.huggingface.co/docs/transformers/pr_42318). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.