noamaanMulla-03/transformers-issues huggingface dataset:
[WIP] Processor moves to `device` in `__call__`
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

This PR allows users to pass the device to processor call and get all inputs in the requested device. Currently the `device` arg is used only in fast image/video processors. But users get confused by the following case

```python
inputs = processor(images, text, device='cuda', return_tensors='pt')

# Before the PR
print(inputs.input_ids.device) # "cpu"
print(inputs.pixel_values.device) # "cuda"

# After the PR
print(inputs.input_ids.device) # "cuda"
print(inputs.pixel_values.device) # "cuda
```

Now we will allow either to pass `device` and get all inputs initialized already on device, or to move to device manually by `inputs.to(device)`

Fixes https://github.com/huggingface/transformers/issues/42722

Comments:
View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43249&sha=703f75
Fix failing `Vip-llava` model integration test
Author: Sai-Suraj-27
Pull request: yes

# What does this PR do?

Fixes this failing [VipLlavaForConditionalGenerationIntegrationTest](https://github.com/huggingface/transformers/actions/runs/20888452873/job/60015689982#step:14:2081)

<img width="1324" height="187" alt="image" src="https://github.com/user-attachments/assets/7553a419-54fc-414d-966e-316fe5aa731d" />


## Before submitting
- [ ] 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?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?
@vasqu

Comments:
**[For maintainers]** Suggested jobs to run (before merge)

run-slow: vipllava

run-slow: vipllava

This comment contains `run-slow`, running the specified jobs: 

models: ["models/vipllava"]
quantizations: []

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43252). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/20958227463)

✅ No failing test specific to this PR 🎉 !
Remove deprecated and unused `position_ids` in all `apply_rotary_pos_emb`
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

As per the title

Comments:
**[For maintainers]** Suggested jobs to run (before merge)

run-slow: afmoe, apertus, arcee, aria, bamba, bitnet, blt, chameleon, cohere, cohere2, csm, cwm, dbrx, deepseek_v3, dia, diffllama

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43255). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43255&sha=fcb9b2
fix `_get_test_info` in `testing_utils.py`
Author: ydshieh
Pull request: yes

# What does this PR do?

This method uses some check like

>  frame.function == test_name

however, when we use `@parameterized.expand`, 

- `frame.function` could be `test_model_logits`
- `test_name` could be `test_model_logits_0_cpu`

and we got some strange error message.

See

```
(Pdb) frame.function
'test_model_logits'
(Pdb) test_name.startswith(frame.function)
True
(Pdb) test_name
'test_model_logits_0_cpu'
```

This PR tries to relax this condition to handle this `parameterized` case.

Comments:
View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43259&sha=ebdf73

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43259). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix failing `Hiera`, `SwiftFormer` & `LED` Model integration tests
Author: Sai-Suraj-27
Pull request: yes

# What does this PR do?

Fixes failing [LEDModelIntegrationTests](https://github.com/huggingface/transformers/actions/runs/20888452873/job/60015690354#step:14:2651), [HieraModelIntegrationTest](https://github.com/huggingface/transformers/actions/runs/20888452873/job/60015689909#step:14:1045) & [SwiftFormer](https://github.com/huggingface/transformers/actions/runs/20888452873/job/60015689552#step:14:1320) tests

<img width="1299" height="123" alt="image" src="https://github.com/user-attachments/assets/1779ef9c-0036-4cfc-8da2-ca265ccae0aa" />



## Before submitting
- [ ] 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?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?
@vasqu

Comments:
run-slow: hiera, led, swiftformer

This comment contains `run-slow`, running the specified jobs: 

models: ["models/hiera", "models/led", "models/swiftformer"]
quantizations: []

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/20922178067)

✅ No failing test specific to this PR 🎉 !


Swiftformer (`test_inference_image_classification_head`) values diff, will update the values later myself

run-slow: hiera, led, swiftformer

**[For maintainers]** Suggested jobs to run (before merge)

run-slow: hiera, led, swiftformer

This comment contains `run-slow`, running the specified jobs: 

models: ["models/hiera", "models/led", "models/swiftformer"]
quantizations: []

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/20961108012)

✅ No failing test specific to this PR 🎉 !


> ## CI Results
> [Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/20961108012)
> 
> ✅ No failing test specific to this PR 🎉 !

Fixed the 1 [failing](https://github.com/huggingface/transformers/actions/runs/20961108012/job/60238549355) test, [here](https://github.com/huggingface/transformers/pull/43245).

> Fixed the 1 [failing](https://github.com/huggingface/transformers/actions/runs/20961108012/job/60238549355) test, https://github.com/huggingface/transformers/pull/43245.

No worries, thank you! Merging now :hugs: 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43225). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[style] Fix init isort and align makefile and CI
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

As per the title. 
`custom_init_isort.py` was broken and not run in `make style`. This is now fixed.
Also, add the same folders in the CI style check as in `makefile` to avoid sync issue, see e.g. https://github.com/huggingface/transformers/pull/43253 where the `benchmark` folder did not cause style issue in the CI, but was complaining when running `make style`

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43260). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43260&sha=2b287c
Qwen-VL video processor accepts min/max pixels
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

Fixes https://github.com/huggingface/transformers/issues/43183 and makes sure we can pass `min/max pixels` to video processor's call.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43228). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@bot /style

Style fix is beginning .... [View the workflow run here](https://github.com/huggingface/transformers/actions/runs/20918127146).

@zucchini-nlp Thanks for helping here. I asked this in the other PR that was trying to fix this: Can you confirm that the new unit test failed without the fix and after the fix the unit test passes? 

@zucchini-nlp Looks like the only blocker left here is some whitespace introduced on line 1478. I am not sure but I think the other CI failure appears like a transient glitch.

**[For maintainers]** Suggested jobs to run (before merge)

run-slow: qwen2_vl, video_llama_3

cc @zucchini-nlp `test_processing_qwen2_5_omni.py::Qwen2_5OmniProcessorTest::test_apply_chat_template_video_frame_sampling` is failing in the CI after this PR! I'm not sure if we just need to update the test values or if this uncovered some deeper bug in the handling for `size` and `min/max_pixels`
Make benchmark-v2 to be device agnostic, to support more torch built-in devices like xpu
Author: yao-matrix
Pull request: yes
Labels: name: run-benchmark

@remi-or , pls help review, thx very much.

Comments:
@SunMarc , could you help take review? Thx very much

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43153). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[docs] tensorrt-llm
Author: stevhliu
Pull request: yes

adds tensorrt-llm guide showing how it uses transformers to the new community integrations section

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43176). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Disabling adapters is not removing the adapter from active adapters
Author: balachandra
Pull request: no

### System Info

Using AWS sagemaker notebook with conda_pytorch_p310 as env.

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

1. Add an adapter to the model using `add_adapter`
2. Disable all adapters using `disable_adapters`
3. List active adapters using `active_adapters`

### Expected behavior

Ideally, when all the adapters are disabled, the active adapters should return an empty list.

Comments:
Hi @balachandra, thanks for raising an issue! 

So that we can be best help you, please make sure to follow the [issue template](https://github.com/huggingface/transformers/blob/main/.github/ISSUE_TEMPLATE/bug-report.yml) and provide: 
* The running environment: run `transformers-cli env` in the terminal and copy-paste the output
* A minimal code snippet we can run to reproduce the error 
* All relevant details about the error including the full error traceback

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

same case
[don't merge] check llama tok test
Author: ydshieh
Pull request: yes

# What does this PR do?

[don't merge] check llama tok test

Comments:
run-slow: llama

This comment contains `run-slow`, running the specified jobs: 

models: ["models/llama"]
quantizations: []

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43248). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43248&sha=8d8a92

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/20950792130)

✅ No failing test specific to this PR 🎉 !
[consistency] Ensure models are added to the `_toctree.yml`
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

As per the title. We don't have a check for it, and we quite often forget it resulting to broken docs at model addition time

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43264). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
FIX#43272, AutoTokenizer failure for cached PreTrainedConfig
Author: AJSTYLE-lab
Pull request: yes
Labels: name: Code agent slop

### Summary
This PR fixes an issue where `AutoTokenizer.from_pretrained(..., trust_remote_code=True)` fails on subsequent runs after the model is cached.  
The error occurred because the code attempted to call `.get()` on a `PreTrainedConfig` object, which does not have a `.get()` method.

### Changes
- Updated the logic in AutoTokenizer loading to safely handle cached `PreTrainedConfig` objects.
- Ensures cached models load consistently regardless of HF authentication state.
- No manual path references are required; works identically for fresh downloads and cached models.

### Fixes
Fixes #43272

### Testing
- Verified that the tokenizer loads correctly on first and second runs.
- Tested with `trust_remote_code=True` enabled.
- Confirmed behavior is consistent whether logged in via `huggingface-cli` or using `HF_TOKEN`.

### Notes
This ensures that reinforcement learning scripts (e.g., using TRL’s GRPO) work reliably with Transformers >=5.0.0rc2 on cached models.


Comments:
**[For maintainers]** Suggested jobs to run (before merge)

run-slow: auto

Hi! This PR fixes the issue #43272 with AutoTokenizer caching. Please review when you have time. And I am waiting for your reply. Thank you.


View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43282&sha=c9e310
Fix TypeError in SummarizationPipeline.check_inputs when max_new_tokens is None
Author: majiayu000
Pull request: yes

# What does this PR do?

Fixes #43093

This PR handles the case where `max_new_tokens` or `min_length` could be `None` in the `check_inputs` method of `SummarizationPipeline`. Previously, comparing `None` with integers would raise a `TypeError`.

The fix adds an early return when either value is `None`, avoiding the comparison that caused the error.

## Before submitting
- [ ] 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/)? Please add a link
      to it if that's the case. Issue: #43093
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?

## Who can review?

@Rocketknight1 (mentioned in the issue)

Comments:
Yes, fix looks good! While we're here, can you update the error message below to say "less than" rather than "inferior than"?

Hi @majiayu000, I'm sorry about this! Since this PR was opened, we decided to finalize deprecation of the `SummarizationPipeline` (PR #43256). It's going to be removed entirely, so we're closing PRs related to it. This fix was good, though, so I hope this doesn't discourage you from contributing to Transformers in future!

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43113&sha=d8e3b0
Fix failing  `PegasusX`, `Mvp` & `LED` model integration tests
Author: Sai-Suraj-27
Pull request: yes

# What does this PR do?

Fixes these failing [PegasusXModelIntegrationTests](https://github.com/huggingface/transformers/actions/runs/20888452873/job/60015688298#step:14:1685), [MvpModelIntegrationTests](https://github.com/huggingface/transformers/actions/runs/20706072009/job/59437072063#step:14:3344) &  [LEDModelIntegrationTests](https://github.com/huggingface/transformers/actions/runs/20888452873/job/60015690354#step:14:2652).

<img width="1308" height="130" alt="image" src="https://github.com/user-attachments/assets/b88e8026-9889-4b5c-9774-486e66e04d1c" />

As mentioned in the [V5 Migration guide](https://github.com/huggingface/transformers/blob/main/MIGRATION_GUIDE_V5.md#3-unified-encoding-api): The `encode_plus` & `batch_decode` methods are deprecated in favor of `__call__` & `decode` methods respectively. And the `clean_up_tokenization_spaces` argument is also no longer used as [mentioned here](https://github.com/huggingface/transformers/pull/42916#issuecomment-3724679285) 


## Before submitting
- [ ] 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?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?
@vasqu

Comments:
run-slow: led, mvp, pegasus_x

This comment contains `run-slow`, running the specified jobs: 

models: ["models/led", "models/mvp", "models/pegasus_x"]
quantizations: []

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/20958088347)

✅ No failing test specific to this PR 🎉 !


> LGTM, will wait for the slow tests before merging!

Sorry, For got to update the expected strings in LED test. Will update.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43245). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

**[For maintainers]** Suggested jobs to run (before merge)

run-slow: led, mvp, pegasus_x
[CB] Ensure parallel decoding test passes using FA
Author: remi-or
Pull request: yes

This PR fixes a flaky test in continuous batching: the test was checking two streams of parallel decoding matched, but used `sdpa` as the attention implementation. But `sdpa` is not batch invariant, so despite a well formed attention mask, the test failed. With flash-attention, it is not the case anymore. It tested the following snippet: 
```
# Imports and implementations [...]
 
num_heads, head_dim, kv_per_query = 32, 64, 32

failures = 0
iters = 1000
for i in range(iters):

    # Create two identical query tokens
    Q = torch.randn(1, num_heads, 2, head_dim)
    Q[:, :, 1] = Q[:, :, 0]
    # Create identical KV cache for both queries
    K_or_V = torch.randn(1, num_heads, 2 * kv_per_query, head_dim)
    K_or_V[:, :, kv_per_query:] = K_or_V[:, :, :kv_per_query]

    # Attention mask to avoid cross-query interactions
    attention_mask = torch.zeros(1, 2, 2 * kv_per_query)
    attention_mask[0, 0, :kv_per_query] = 1
    attention_mask[0, 1, kv_per_query:] = 1

    # Use SDPA to compute attention
    output = compute_attention(Q, K_or_V, K_or_V, attention_mask)

    # Check using absolute and relative differences
    query_0_output, query_1_output = output[:, :, 0], output[:, :, 1]
    is_ok = torch.isclose(query_0_output, query_1_output).all().item()
    failures +=  1 - is_ok
```

and the number of failure for each implementation was:
- `sdpa`: 597
- `eager`: 156
- `kernels-community/flash-attn`: 0

So I went with flash attention for the test.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43277). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix typo: necesary → necessary
Author: Arthi706
Pull request: yes


Comments:
I investigated the CI failure in `IdeficsProcessorTest::test_save_load_pretrained_additional_features`

The test passes locally:

pytest tests/models/idefics/test_processing_idefics.py -k test_save_load_pretrained_additional_features

This PR only updates comments/docstrings, so the CI failure appears unrelated/flaky.
Happy to rerun CI if needed.

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43271&sha=f314a9

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43271). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

cc @ydshieh we definitely have some flaky tests here! Some of them look like Hub connection issues but I think we probably want to mark `test_prompt_lookup_decoding_matches_greedy_search` as flaky?