noamaanMulla-03/transformers-issues huggingface dataset:
[CI] Use pre-computed `_OLD_MODELS` in `test_new_models_require_torchvision_backend`
Author: ydshieh
Pull request: yes

# What does this PR do?

So we don't need to use `fetch-depth: 0` 

```bash
      - name: Checkout repository
        uses: actions/checkout
        with:
          fetch-depth: 0
```
which is quite slow.

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

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46882)

great! I assume this is a one shot stuff and we will never change this list
Install in docker
Author: ydshieh
Pull request: yes

# What does this PR do?

Install in docker to reduce installation time in CI time

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

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46910)
Redirect to diffusers pipe in docs for experimental features
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

as per title, the model was added just yesterday in `diffusers` and dllm arch will prob be hosted in `diffusers`. They already have 2 models merged and a few ongoing PRs

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

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46875)
[CB] Changes to increase max_batch_tokens
Author: remi-or
Pull request: yes

# Summary

This PR aims at increasing the performances of continuous batching, especially for prefill batches. To that order, it changes the following things:
- rework the cache size estimator by adding a default `max_batch_tokens` of 8192 and applying a VRAM-based bound. In effect, this means that the prefill batches can now be much bigger
- along with this behavioral change, the cache size estimator has been reworked to be more readable and self contained
- deprecate the `max_cached_graph` attributes, because it was made useless by the graph pool: since all graphs share the same pool, the memory footprint of new graphs is negligible. Actually, this parameter was hurting performance because discarding and recording new graphs led to fragmentation and more memory being used in the end

## Performance ✅ 

label | main acc | new PR acc | main (tok/s) | new PR (tok/s) | diff
-- | -- | -- | -- | -- | --
gsm8k_default | 0.825 | 0.822 | 2477.36 | 3301.09 | +33.25%
gsm8k_sampling | 0.790 | 0.788 | 1952.49 | 2936.00 | +50.37%
gsm8k_compile | 0.825 | 0.823 | 2477.76 | 3444.92 | +39.03%
gsm8k_no_fast_decode | 0.825 | 0.822 | 2364.45 | 2348.65 | -0.67%
gsm8k_bare_bones | 0.825 | 0.816 | 1886.61 | 1911.51 | +1.32%
ifeval_default | 0.457 | 0.445 | 8958.99 | 10163.10 | +13.44%
few_blocks | - | - | 666.69 | 674.44 | +1.16%
multi_return_seq | - | - | 1626.68 | 1764.44 | +8.47%
rollouts_1024 | - | - | 3545.67 | 3609.38 | +1.80%
rollouts_2048 | - | - | 3363.86 | 3394.07 | +0.90%
rollouts_4096 | - | - | 2958.96 | 2984.04 | +0.85%
rollouts_8192 | - | - | 2360.50 | 2362.29 | +0.08%
rollouts_16384 | - | - | 1549.78 | 1537.00 | -0.83%

Big performance improvements for prefill-bound workloads. Small accuracy regression on "bare-bones", because the size of the batch affects the generated tokens.

## Tests ✅ 

This PR adds a new test to verify the actual memory footprint is aligned with the expected one.
All tests pass

## AI Review ✅ 

Reviewed and addressed. 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_46712). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix flash attention with StaticCache
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

Discovered by the @remi-or, FA was broken with flash and StaticCache because the mask is wrongly set as None, which means `is_causal` will be wrong as the k/v are padded

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

run-slow: llama

[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/28231157654)

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

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

run-slow: llama

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

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [d6aede6d](https://github.com/huggingface/transformers/commit/d6aede6d5ea4d46098558c2cc0a57092efc86012) | workflow commit (merge commit) |
| PR | [a31b32b3](https://github.com/huggingface/transformers/commit/a31b32b3496f71091c2784d1eca4a8676aeaf545) | branch commit (from PR) |
| main | [2a1796af](https://github.com/huggingface/transformers/commit/2a1796afd0cc887614252096d254a6f4390f88e5) | base commit (on `main`) |

⚠️ No test being reported (jobs are skipped or cancelled)!


[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/28232163532)

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

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

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

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [7f2f50ea](https://github.com/huggingface/transformers/commit/7f2f50ea8c861291cd9cf2d4147cb264dce13a86) | workflow commit (merge commit) |
| PR | [62d39c59](https://github.com/huggingface/transformers/commit/62d39c59022e45abe0a364e7809c97638414e3f1) | branch commit (from PR) |
| main | [ed7d6c8d](https://github.com/huggingface/transformers/commit/ed7d6c8dbcc7a56b01fd23d7de58fb4731c394d8) | base commit (on `main`) |

✅ No failing test specific to this PR 🎉 👏 !


**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46914)

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

run-slow: llama
Fix dtype casting for quantized multimodal embedders
Author: praful-srinivasan-027
Pull request: yes

# What does this PR do?

Fixes #46899.

This PR fixes dtype casting in the Gemma4 Unified multimodal embedders when using 4-bit BitsAndBytes quantization.

Previously, the multimodal embedders cast inputs to `layer.weight.dtype`. For `bitsandbytes.nn.Linear4bit`, `weight.dtype` is `torch.uint8`, which represents the packed storage format rather than the computation dtype. This caused multimodal inputs to be cast to `uint8`, leading to dtype mismatches during generation.

This change uses the layer's `compute_dtype` when available, falling back to `weight.dtype` for standard `nn.Linear` layers. The fix is applied to both `Gemma4UnifiedMultimodalEmbedder` and `Gemma4UnifiedVisionEmbedder`, preserving the existing behavior for unquantized models while correctly handling quantized `Linear4bit` layers.

I reproduced the reported issue using the provided reproduction script with 4-bit quantization and verified that the dtype mismatch no longer occurs after this change.

## Code Agent Policy

* [x] I confirm that this is not a pure code agent PR.

## Before submitting

* [ ] This PR fixes a typo or improves the docs (not applicable).
* [x] Did you read the contributor guideline and the Pull Request checks?
* [x] Was this discussed/approved via a Github issue or the forum? (Fixes #46899)
* [ ] Did you make sure to update the documentation with your changes according to the guidelines? (not applicable)
* [ ] Did you write any new necessary tests?

## Who can review?

@zucchini-nlp @SunMarc


Comments:
@bot /style

Style fix bot fixed some files and pushed the changes.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_46904). 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: gemma4_unified

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46904)
Fix yolos
Author: molbap
Pull request: yes

# What does this PR do?

Fixes #46869 

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

run-slow: yolos

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46922)

run-slow: yolos

[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/28248639094)

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

models: ["models/yolos"]
quantizations: []

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_46922). 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/28248639094)

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [20705d73](https://github.com/huggingface/transformers/commit/20705d738ebd504766f6441c5fe489767b9d869a) | workflow commit (merge commit) |
| PR | [d589c977](https://github.com/huggingface/transformers/commit/d589c977ca39c0d63936201daf7a936a7d376206) | branch commit (from PR) |
| main | [252b7b18](https://github.com/huggingface/transformers/commit/252b7b18840d9f1768e7dce11d486764e0474fd9) | base commit (on `main`) |

### Model CI Report

❌ **[2 new failed tests from this PR](https://huggingface.co/datasets/hf-internal-testing/transformers_pr_ci/raw/5aa7e5102a6d6177e2b9156a7311255d8dbddea2/2026-06-26/runs/36947-28248639094/ci_results_run_models_gpu/new_failures_with_bad_commit.json)** 😭

- [yolos](https://github.com/huggingface/transformers/actions/runs/28248639094/job/83697937458):
    tests/models/yolos/test_modeling_yolos.py::YolosModelTest::test_disk_offload_bin (✅ ⟹ ❌)
    tests/models/yolos/test_modeling_yolos.py::YolosModelTest::test_disk_offload_safetensors (✅ ⟹ ❌)
[Docs] Fix full disk offloading docs
Author: kylesayrs
Pull request: yes

## Purpose ##
* Fix incorrect documentation which states that `max_memory={}` does not trigger full disk offloading
* Document `accelerate>1.14.0` requirement for full disk offloading

## Testing ##
The code below demonstrates that full disk offloading does indeed occur when `max_memory={}`
```python3
from transformers import AutoModelForCausalLM

# Load model with full disk offload
model = AutoModelForCausalLM.from_pretrained(
    "google/gemma-7b",
    device_map="auto",
    max_memory={},
    offload_folder="./offload_folder",
)

assert model.hf_device_map == {"": "disk"}
assert model.model.layers[0].self_attn.q_proj.weight.device.type == "meta"
```

## Suggested Reviewers ##
@stevhliu @SunMarc 

Comments:
**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46905)

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_46905). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Proposal to add Qwen3-ASR support
Author: mbtariq82
Pull request: no
Labels: name: New model

### Model description

Model: Qwen3-ASR
Repository: https://github.com/QwenLM/Qwen3-ASR
Paper: https://arxiv.org/abs/2601.21337
License: Apache 2.0

Qwen3-ASR would make a good addition to Transformers. It uses models that are already integrated in the library such as Qwen2TokenizerFast and WhisperFeatureExtractor. Transformers already has other ASR models such as Qwen2-Audio, Parakeet and SeamlessM4T.

Would the maintainers be open to this addition? I've created a basic PR adding the processor and some corresponding tests for now. If I get the go ahead, I'll add the rest of the model. 

### Open source status

- [x] The model implementation is available
- [x] The model weights are available

### Provide useful links for the implementation

https://huggingface.co/spaces/Qwen/Qwen3-ASR

Comments:
[`Dia`] Fix docs
Author: vasqu
Pull request: yes

As per title, the docs got messed up in #45608 removing torch_device as var and somehow doing some weird mixture of to and auto device(?)

Let's keep it simple

Fixes #46909
Closes #46915
There is also https://github.com/Ankita7033/transformers/pull/1 but it's on a fork (which uses the same solution); adding as coauthor

Comments:
Will merge this (after fast CI) as I tested locally that things run again and it's only a minor doc fix but quite important

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46923)

cc @stevhliu just so that you're in the loop

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_46923). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
broken documentation example for DIA
Author: Carotterap
Pull request: no
Labels: name: bug

### System Info

Documentation for DIA is a bit weird: 
https://huggingface.co/docs/transformers/model_doc/dia#generation-with-text

- torch device does not exist 
- to device map auto does not exist
```python
from transformers import AutoProcessor, DiaForConditionalGeneration


model_checkpoint = "nari-labs/Dia-1.6B-0626"

text = ["[S1] Dia is an open weights text to dialogue model."]
processor = AutoProcessor.from_pretrained(model_checkpoint)
inputs = processor(text=text, padding=True, return_tensors="pt").to(model.device)

model = DiaForConditionalGeneration.from_pretrained(model_checkpoint).to(torch_device, device_map="auto")
outputs = model.generate(**inputs, max_new_tokens=256)  # corresponds to around ~2s

# save audio to a file
outputs = processor.batch_decode(outputs)
processor.save_audio(outputs, "example.wav")

```
cc @eustlb

### 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

.

### Expected behavior

.

Comments:
I'd like to fix this. The example has three issues: inputs = ...().to(model.device) references model before it's defined, torch_device is never defined, and device_map="auto" is passed to .to() (it's a from_pretrained argument, not a .to() argument). I'll correct the example so model is created first with device_map="auto" in from_pretrained, then move inputs to model.device. PR incoming.

Yep the docs are broken, it was done in #45608 (where you can also see that torch device was removed as variable etc) - claude did not well on this 😢 

Fixing in #46923 and attributed you @Ankita7033 (you opened the PR on your own fork, not our repo so added you as co author since it's the same idea as I had)

Thanks @vasqu, glad the fix is landing in #46923 — and thanks for the co-attribution! Closing this since it's now resolved.
Replace VideoMAE sinusoid encoding helper with PyTorch implementation
Author: praful-srinivasan-027
Pull request: yes

## What does this PR do?

This PR replaces the NumPy implementation of `get_sinusoid_encoding_table` in `modeling_videomae.py` with an equivalent vectorized PyTorch implementation.

As part of this refactor, fixed sinusoidal positional embeddings are registered as non-persistent buffers and reinitialized in `_init_weights`, making the model compatible with meta device initialization while preserving the existing sinusoidal encoding behavior.

This also resolves the existing TODO to implement the helper using PyTorch.

**Current status:** This PR is opened as a draft while investigating a model-parallel regression introduced by the buffer registration changes. The meta initialization tests now pass, but `test_model_parallelism` still requires investigation.


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

run-slow: videomae

Hi @yonigozlan! I opened this as a draft because I'd appreciate some guidance.

While replacing the NumPy implementation of `get_sinusoid_encoding_table` with a PyTorch version, I updated the fixed positional embeddings to be registered as non-persistent buffers and reinitialized them in `_init_weights` so that the model passes the meta initialization tests.

However, this introduces a failure in `test_model_parallelism` due to a device mismatch between `sequence_output` and the positional embeddings after model sharding.

Before I continue, I wanted to check whether this is the expected approach for making these fixed positional embeddings compatible with meta initialization. If so, is there a recommended pattern for handling the model-parallel case as well? If not, I'd appreciate any guidance on the preferred approach.

Thanks!


**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46924)
[integration] add pluto experiment tracker callback.
Author: asaiacai
Pull request: no
Labels: name: Feature request

### Feature request

add `PlutoCallback` as an option for natively logging to the pluto experiment tracker.

### Motivation

We recently launched a new OSS experiment tracker ([client code](https://github.com/Trainy-ai/pluto), [server code](https://github.com/Trainy-ai/pluto-server)), and we're hoping to get integrated as a logging callback option for those using `transformers`. We're currently offering a hosted version as well in the link below.

https://pluto.trainy.ai/

hoping to hear back if it is okay if we open a PR for this. Quite a few of our users moved from Neptune given the shutdown so we want to close the gap so people have to time to try it out before the Neptune shutdown date.

### Your contribution

I will be drafting the PR and managing it until it is merged.

Edit: here's a link to our [live demo](https://demo.pluto.trainy.ai/o/dev-org/projects/my-ml-project?runs=UkLWZ%2CgbHJd%2CEfhxL%2CVqXmZ%2Cuw2YK)

Comments:
I can work on this feature request
[NemotronAsrStreaming] processor without modular
Author: eustlb
Pull request: yes

# What does this PR do?

Cleaner. No BC issues here since model not yet released and [hub PR](https://huggingface.co/nvidia/nemotron-speech-streaming-en-0.6b/discussions/17) not yet merged 


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_46865). 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: nemotron_asr_streaming

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46865)
[NemotronAsrStreaming] fix pipeline
Author: eustlb
Pull request: yes

# What does this PR do?

Nit fix for pipeline usage


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

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46870)

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

run-slow: nemotron_asr_streaming
Fix dtype cast in TimesFM 2.5 ResidualBlock for quantized weights
Author: JOhnsonKC201
Pull request: yes

# What does this PR do?

`TimesFm2_5ResidualBlock.forward` unconditionally casts its float input to the block's weight dtype:

```python
x = x.to(self.input_layer.weight.dtype)
```

`input_layer` is an `nn.Linear`, and this block is used as the model's input projection (`input_ff_layer`), so the **raw float time-series inputs** flow through it. When the model is loaded with quantization (e.g. `bitsandbytes` 4/8-bit), `input_layer.weight.dtype` is an **integer** type (e.g. `uint8`). Casting the float inputs to an int dtype silently truncates them to zeros (`0.73 -> 0`), so the model produces garbage outputs with no error or warning.

The fix only casts when the weight dtype is floating point, preserving the original mixed-precision behavior while skipping the destructive cast under quantization:

```python
if (target_dtype := self.input_layer.weight.dtype).is_floating_point:
    x = x.to(target_dtype)
```

This is the same pattern already applied to the multimodal embedders in `gemma4_unified` (#46904) and `gemma4` (#46933).

Both `modular_timesfm2_5.py` and the generated `modeling_timesfm2_5.py` are updated to stay in sync.

## 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)?
- [x] Was this discussed/approved via a GitHub issue? Please add a link to it if that's the case. (Same class of bug as #46904 / #46933.)
- [ ] Did you make sure to update the documentation with your changes? N/A.
- [ ] Did you write any new necessary tests? Follows the precedent of #46904/#46933 (dtype-safety guard, no new test).

## Who can review?

@kashif @SunMarc

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

run-slow: timesfm2_5

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46942)

Small, self-contained fix (+10/-4, with `modular_timesfm2_5.py` and the generated `modeling_timesfm2_5.py` kept in sync). The destructive cast only triggers under quantization, where `input_layer.weight.dtype` is an integer type — so the float time-series inputs get silently truncated to zeros with no error in normal fp runs. Same failure mode and fix as the multimodal embedders in #46904 and #46933.

Happy to run `run-slow: timesfm2_5` or adjust anything once a maintainer has a chance to look. Thanks!

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

# What does this PR do?

Moved the script to Python, in utils, and insert a badge in the PR

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

**CI Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46774)