noamaanMulla-03/transformers-issues huggingface dataset:
Remove deprecated training args
Author: cyyever
Pull request: yes

# What does this PR do?

Remove deprecated training args
 
- [x] I confirm that this is not a pure code agent PR.

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://huggingface.co/docs/transformers/contributing) and the
      [Pull Request](https://huggingface.co/docs/transformers/pr_checks) checks?
- [ ] 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 according to the [guidelines](https://github.com/huggingface/transformers/tree/main/docs)?
- [ ] Did you write any new necessary [tests](https://huggingface.co/docs/transformers/testing)?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker @Cyrilvallez @vasqu
- vision models: @yonigozlan @molbap
- audio models: @eustlb @ebezzam @vasqu
- multimodal models: @zucchini-nlp
- graph models: @clefourrier

Library:

- generate: @zucchini-nlp (visual-language models) or @Cyrilvallez (all others)
- continuous batching: @remi-or @ArthurZucker @McPatate
- pipelines: @Rocketknight1
- tokenizers: @ArthurZucker and @itazap
- trainer: @SunMarc
- attention: @vasqu @ArthurZucker @CyrilVallez
- model loading (from pretrained, etc): @CyrilVallez
- distributed: @3outeille @ArthurZucker
- CIs: @ydshieh

Integrations:

- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization: @SunMarc
- kernels: @vasqu @drbh
- peft: @BenjaminBossan @githubnemo

Devices/Backends:

- AMD ROCm: @ivarflakstad
- Intel XPU: @IlyasMoutawwakil
- Ascend NPU: @ivarflakstad 

Documentation: @stevhliu

Research projects are not maintained and should be taken as is.

 -->


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

run-slow: byt5

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

cc @SunMarc if we're okay to remove these!
Fix Moonshine streaming right window boundary
Author: he-yufeng
Pull request: yes
Labels: name: Code agent slop

## What does this PR do?

Fixes the Moonshine streaming right-window mask so `right_window_size=4` includes four future frames instead of three.

The left window already uses a strict comparison because the current query frame is included on the left side. The right side excludes the query frame with `dist < 0`, so the boundary frame should use `<= right_window_size`.

Fixes #46305

## Tests

- `PYTHONPATH=src python -c "import sys; sys.modules['kernels']=None; from transformers.models.moonshine_streaming.modeling_moonshine_streaming import sliding_window_mask_function; mask=sliding_window_mask_function((16,4)); future=[i for i in range(11,16) if mask(0,0,10,i)]; print(future); assert future == [11,12,13,14]; assert not mask(0,0,10,15)"`
- `python -m py_compile src\transformers\models\moonshine_streaming\modular_moonshine_streaming.py src\transformers\models\moonshine_streaming\modeling_moonshine_streaming.py tests\models\moonshine_streaming\test_modeling_moonshine_streaming.py`
- `python -m ruff check src\transformers\models\moonshine_streaming\modular_moonshine_streaming.py src\transformers\models\moonshine_streaming\modeling_moonshine_streaming.py tests\models\moonshine_streaming\test_modeling_moonshine_streaming.py`
- `python utils\check_copies.py --fix_and_overwrite`
- `git diff --check`

`pytest tests\models\moonshine_streaming\test_modeling_moonshine_streaming.py::MoonshineStreamingModelTest::test_sliding_window_right_context_includes_boundary_frame -q` was blocked in my local Windows environment by an unrelated global `kernels` package import error: `ValueError: Either a revision or a version must be specified.`


Comments:
I checked the `setup_and_quality` failure. The failing step was `make check-repository-consistency`, and the actionable diff was the generated Gemma4 copy of the Moonshine sliding-window helper still using `< right_window_size`.

I rebased the branch onto current `upstream/main` and synced that generated Gemma4 boundary to `<= right_window_size` so it matches the Moonshine modular source.

Local validation:
- `python -m py_compile` on the touched Moonshine/Gemma4/test files
- `python -m ruff check` on the touched files
- `python -m ruff format --check` on the touched files
- `git diff --check upstream/main..HEAD`

The refreshed CI is running now.

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

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

run-slow: gemma4, moonshine_streaming

This profile belongs to a bot that opens a large number of pull requests. In line with our contribution guidelines, this is not the type of contribution we encourage.
only in the original repo
Author: tarekziade
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=46982)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46982)
<!-- ci-dashboard-badge:end -->

# What does this PR do?

Don't run this workflow in forks

Comments:
<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46982)
**Latest run:** [28472136373:1](https://github.com/huggingface/transformers/actions/runs/28472136373)
**Result:** `success` | **Jobs:** 2 | **Tests:** 2 | **Failures:** 0 | **Duration:** 9s

<!-- ci-dashboard-recap:end -->

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_46982). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix typo in `MusicgenForCausalLM.generate()`
Author: jiqing-feng
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=46974)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46974)
<!-- ci-dashboard-badge:end -->

`input_ids_length` is an `int` (the sequence length), not a tensor, so calling
`.shape[1]` on it makes `MusicgenForCausalLM.generate()` always raise
`AttributeError: 'int' object has no attribute 'shape'`. It should reference
`input_ids` instead, matching `generation/utils.py` and the already-correct
`musicgen_melody` copy.

```diff
-            input_ids_length.shape[1] != input_ids_length
+            input_ids.shape[1] != input_ids_length
             and model_input_name == "inputs_embeds"
             and not self.config.is_encoder_decoder
         ):
-            max_cache_length += input_ids_length.shape[1]
+            max_cache_length += input_ids.shape[1]
```

## Reproduction

```python
import torch
from transformers import MusicgenForConditionalGeneration

dec = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-medium").decoder
pad = dec.config.pad_token_id
ids = torch.full((dec.config.num_codebooks, 8), pad, dtype=torch.long)
# before the fix: AttributeError: 'int' object has no attribute 'shape'
dec.generate(input_ids=ids, max_new_tokens=16, pad_token_id=pad,
             decoder_start_token_id=pad, num_return_sequences=1)
```

<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46974)
**Latest run:** [28421284920](https://github.com/huggingface/transformers/actions/runs/28421284920)
**Result:** `success` | Grafana metrics are not available yet.

<!-- ci-dashboard-recap:end -->

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

run-slow: musicgen
Reporting a vulnerability
Author: Eti-Hack
Pull request: no

@Michellehbn  @ArthurZucker
need access to the Huggingface Private Bug Bounty Program

https://hackerone.com/hugging_face

I request the team to send me an invite for the Huggingface Private Bug Bounty Program

My Hackerone username: raz_26

I had already email to the security team but not yet get any response

Hope the team will send me an invite soon

Regards

Comments:
Hi @Eti-Hack , Thanks for reaching out. Note that security@huggingface.co is the best place for this kind of request. Please be sure to review the program scope and rules before submission. We've sent you an invite and if you run into any issues submitting to our private program please let us know!
fix(models): fix MPS float64 type compatibility crashes for MusicFlamingo and UDOP
Author: aoright
Pull request: yes
Labels: name: Code agent slop

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=46987)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46987)
<!-- ci-dashboard-badge:end -->

Fixes #46723

### Summary
While auditing models for Apple Silicon (MPS) compatibility, it was found that MusicFlamingo and UDOP hardcode `torch.float64` in their forward pass. Since the MPS backend does not support float64, running these models on macOS (MPS) crashes with `TypeError: Cannot convert a MPS Tensor to float64 dtype`.

This PR dynamically checks the device type and falls back to `torch.float32` on MPS devices, keeping `torch.float64` for CPU and CUDA devices to preserve existing behavior and precision.

### Changes
1. **MusicFlamingo**: Updated `apply_rotary_time_emb` in `modular_musicflamingo.py` to use `float32` on MPS devices and regenerated `modeling_musicflamingo.py`.
2. **UDOP**: Updated `combine_image_text_embeddings` in `modeling_udop.py` to use `float32` for bbox upcasting on MPS devices.
3. **Tests**: Added regression/unit tests in `test_musicflamingo_mps.py` and `test_udop_mps.py` to verify these functions execute properly on MPS without crashes.

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

run-slow: musicflamingo, timesfm2_5, udop

<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46987)
**Latest run:** [28489529908:2](https://github.com/huggingface/transformers/actions/runs/28489529908)
**Result:** `success` | **Jobs:** 2 | **Tests:** 7 | **Failures:** 0 | **Duration:** 21s

<!-- ci-dashboard-recap:end -->
Add MLU support to is_flash_linear_attention_available
Author: atri2549
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=46995)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46995)
<!-- ci-dashboard-badge:end -->

### What does this PR do?

This PR adds MLU device support to `is_flash_linear_attention_available()` by allowing flash linear attention (`fla`) to be used on MLU devices in addition to CUDA.

### Why is this needed?

MLU devices support flash linear attention, but the current availability check only allows CUDA. This prevents models that rely on `fla` (e.g., Qwen3.5, Qwen3-Next, OLMo-Hybrid) from using the feature on MLU hardware.

### Implementation details

- Add `is_torch_mlu_available()` check to `is_flash_linear_attention_available()` using the same `cuda or mlu` pattern already used in `is_flash_attn_2_available()`.
- No behavioral change for CUDA or any other accelerator.

### Impact

Enables flash linear attention on MLU devices. No impact on other backends.

Comments:
<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46995)
**Latest run:** [28510401907:2](https://github.com/huggingface/transformers/actions/runs/28510401907)
**Result:** `failure` | **Jobs:** 13 | **Tests:** 63,153 | **Failures:** 0 | **Duration:** 17h 49m

<!-- ci-dashboard-recap:end -->

cc @arthurzucker for FA I think!
Fix typo in Qwen3 ASR no_split_module
Author: ebezzam
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=47002)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=47002)
<!-- ci-dashboard-badge:end -->

# What does this PR do?

As title says

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

run-slow: qwen3_asr

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

run-slow: qwen3_asr

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

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

models: ["models/qwen3_asr"]
quantizations: []

<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=47002)
**Latest run:** [28521512631:1](https://github.com/huggingface/transformers/actions/runs/28521512631)
**Result:** `success` | **Jobs:** 4 | **Tests:** 101 | **Failures:** 0 | **Duration:** 3m 24s

<!-- ci-dashboard-recap:end -->

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

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [ece0ef2e](https://github.com/huggingface/transformers/commit/ece0ef2eb90d2a3eadabbab3c86fc0694bd4c2dc) | workflow commit (merge commit) |
| PR | [d2e85df2](https://github.com/ebezzam/transformers/commit/d2e85df2884160a745b952474ea0f90bb0f39309) | branch commit (from PR) |
| main | [36778030](https://github.com/huggingface/transformers/commit/36778030cba4bccfcb15366d7ad860ca30f47417) | base commit (on `main`) |

✅ No failing test specific to this PR 🎉 👏 !
Raise a loud error for missing prefix
Author: Rocketknight1
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=46980)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46980)
<!-- ci-dashboard-badge:end -->

The new chat response parser requires the prompt tokens to be passed to the `prefix` argument, but if they're not passed it just assumes an empty prefix. In testing I found it was very easy to forget it, and just get silently wrong parsing. This would definitely trip lots of users up, so this modifies `parse_response` so that it yells at you if you forget `prefix`. The other changes are doc/test changes to match. Pipelines already worked correctly and so they're unchanged.

This creates a slightly awkward API right now where `prefix` is unsupported for old response schemas but mandatory for new templates, but that'll all get cleaned up as soon as I can deprecate and drop response schemas.

cc @vasqu for review but if you're overloaded let me know and I'll pass it on to someone else!

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

<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46980)
**Latest run:** [28515101598:1](https://github.com/huggingface/transformers/actions/runs/28515101598)
**Result:** `failure` | **Jobs:** 13 | **Tests:** 48,454 | **Failures:** 0 | **Duration:** 14h 9m

<!-- ci-dashboard-recap:end -->
[serge] Fix 8 integration tests for model `mamba2` failing with `OOM` (other (8))
Author: sergereview[bot]
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=47001)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=47001)
<!-- ci-dashboard-badge:end -->

## Original CI failure

- Failure group: `1/1: 8 integration tests for model `mamba2` failing with `OOM` (other (8))`
- `tests/models/mamba2/test_modeling_mamba2.py::Mamba2IntegrationTest::test_batched_equivalence_with_cache` [multi-gpu] (OOM, seen 7/7)

<!-- serge-task:integration-failure-triage:sha256:3189716405a9beee6a52784ddb789f18883ffb200eb77a11b9189d970018dbd7 -->
Relates to #46998

The mamba2 integration tests consistently OOM on the 22 GB CI GPUs because the 7B `Mamba-Codestral-7B-v0.1` model in bfloat16 leaves too little room for generation activations and because the mixer equivalence test uses a full-size synthetic batch.

This patch:
- Shrinks the synthetic mixer test from `(B=4, T=512, D=768)` to `(B=2, T=256, D=768)`, cutting its activation memory by ~8× while preserving the train/eval equivalence check.
- Trims the batched-generation prompt lists from three (including a very long Rust prompt) to two shorter prompts, reducing batch size and padded sequence length.
- Adds guarded `torch.cuda.empty_cache()` calls after model loading and between batched and individual generation to combat fragmentation.

These are test-only changes that keep the regression coverage intact.

---
_This change was produced automatically by serge from a CI failure report. The patch was generated by an LLM and applied by serge; review before merging._

_serge `v0.1.0` · model: `moonshotai/Kimi-K2.7-Code` · 31 LLM turns · 30 tool calls · 155.6s · 556165 in / 12074 out tokens_

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

run-slow: mamba2

<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=47001)
**Latest run:** [28518480449](https://github.com/huggingface/transformers/actions/runs/28518480449)
**Result:** `failure` | Grafana metrics are not available yet.

> **Code quality check failed**: test jobs were skipped. Fix the code quality issues and push again to run tests.

<!-- ci-dashboard-recap:end -->

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

Closing: this PR was opened before serge's normalize gate was fixed, so its patch was committed un-normalized and fails the CI code-quality check. The gate bypass (forced-final answers skipping validation) + the Job RBAC/image issues are now fixed; a subsequent run will reopen a normalized fix for this failure group.
[serge] Fix 1 integration tests regressed by commit 1f3294c82c1d (PR #46850)
Author: sergereview[bot]
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=46999)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46999)
<!-- ci-dashboard-badge:end -->

## Original CI failure

- Failure group: `1/1: 1 integration tests regressed by commit 1f3294c82c1d (PR #46850)`
- `tests/models/phimoe/test_modeling_phimoe.py::PhimoeIntegrationTest::test_phimoe_instruct_with_static_cache` [single-gpu] (OOM, seen 6/7)

<!-- serge-task:integration-failure-triage:sha256:6aeb741f4078e0ea2c8bae4cc16a86ae8bf2cc1203e5b1a080971d54bc776066 -->

Relates to #46998

`PhimoeIntegrationTest::test_phimoe_instruct_with_static_cache` OOMs because the test helper over-allocates the static cache. The helper passes `max_seq_len + prompt_length` as the cache length, but the generation loop never processes more than `max_seq_len` total tokens (prompt + generated). Reducing the pre-allocated cache size to `max_seq_len` removes the excess 1.5 GiB allocation that pushes the single-GPU CI runner over its memory limit.

The generation semantics and expected output are unchanged.

Root cause: test helper `PhimoeMiniWithStaticCache.generate` over-allocates `StaticCache`.
Fix: pass `max_seq_len` instead of `max_seq_len + prompt_tokens.shape[-1]` as the cache length.

---
_This change was produced automatically by serge from a CI failure report. The patch was generated by an LLM and applied by serge; review before merging._

_serge `v0.1.0` · model: `moonshotai/Kimi-K2.7-Code` · 31 LLM turns · 30 tool calls · 43.4s · 547285 in / 5024 out tokens_

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

run-slow: phimoe

<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=46999)
**Latest run:** [28516228932](https://github.com/huggingface/transformers/actions/runs/28516228932)
**Result:** `success` | Grafana metrics are not available yet.

<!-- ci-dashboard-recap:end -->

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

Closing: this PR was opened before serge's normalize gate was fixed, so its patch was committed un-normalized and fails the CI code-quality check. The gate bypass (forced-final answers skipping validation) + the Job RBAC/image issues are now fixed; a subsequent run will reopen a normalized fix for this failure group.
[docs] update cache apis
Author: stevhliu
Pull request: yes

adds `get_max_length` + docstring to the API docs (related to #46862)

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=46892)

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

### Model description

- https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash/tree/main

### Open source status

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

### Provide useful links for the implementation

_No response_

Comments:
Hi @ArthurZucker , I would love to take this on and contribute the implementation for **MiMo-V2-Flash** to `transformers`.

I've reviewed the model's technical details, specifically the **Hybrid Sliding Window Attention** and the **MoE structure** (309B params/15B active). Given the large weight size, I plan to start by:

1. Setting up the model architecture using the **Modular Transformers** approach.
2. Verifying the implementation locally with a **scaled-down dummy configuration** to ensure tensor shapes are correct without needing to download the full weights.
3. Working on a conversion script for the weights once the architecture is stable.

I'll open a Draft PR shortly to track my progress. Are there any specific existing models you recommend I use as a reference for the Hybrid Attention implementation?


@Aznix07 Is it ok if we work together on this ?