noamaanMulla-03/transformers-issues huggingface dataset:
[cache] Remove all deprecated classes
Author: Cyrilvallez
Pull request: yes

# What does this PR do?



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

run-slow: ministral, moshi

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43168). 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=43168&sha=18b4ad

i think we'll also need to update the docs [here](https://huggingface.co/docs/transformers/main/en/optimization_overview#caching) and [here](https://huggingface.co/docs/transformers/main/en/kv_cache) which mention the `OffloadedCache`?

I think we really want to move away from the many many cache classes we had before, so let's not keep any alias!

@stevhliu, we only remove the `OffloadedCache` class, but `cache_implementation="offloaded"` or `cache_implementation="offloaded_static"` are still valid! It's just the classes that are removed, but the logic for those stay the same!
Bump huggingface_hub minimal version
Author: Wauplin
Pull request: yes

This PR bumps `huggingface_hub` minimal version to 1.3.0 (current latest release, see https://github.com/huggingface/huggingface_hub/releases/tag/v1.3.0).

This release includes:
- https://github.com/huggingface/huggingface_hub/pull/3666 => running `transformers` CLI will now run an auto-update check similar to what we do for `hf` CLI. If a new version is available, we let the user know + provide the exact command line to run
- https://github.com/huggingface/huggingface_hub/pull/3668 => fixes this [TODO](https://github.com/huggingface/transformers/blob/3a275d3581c0ecf962f7412aa764c2047331fd6b/pyproject.toml#L53C2-L53C44). I'll open a separate PR with all the code style fixes. => **EDIT:** opened https://github.com/huggingface/transformers/pull/43189

---

(Failing CI doesn't seem related to this PR)

Comments:
View the CircleCI Test Summary for this PR:

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

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

# What does this PR do?

As per the title. It has become a mess so let's update it

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43191). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[style] Use 'x | y' syntax for processors as well
Author: Wauplin
Pull request: yes

Related to https://github.com/huggingface/huggingface_hub/pull/3668 (shipped in [huggingface_hub 1.3.0](https://github.com/huggingface/huggingface_hub/releases/tag/v1.3.0)) and https://github.com/huggingface/transformers/issues/43144.

This PR requires `huggingface_hub>=1.3.0` to work (otherwise `@strict` dataclass validation does not work properly). I opened a separate PR https://github.com/huggingface/transformers/pull/43188 to bump the minimal version.

cc @Cyrilvallez  @zucchini-nlp who initiated this work 

---

As mentioned on Slack:

> I opened https://github.com/huggingface/transformers/pull/43189 to fix the union syntax but I'm getting some errors related to that change. They are not related to the huggingface_hub bump itself. @Cyrilvallez @zucchini-nlp Can I let you look into them? I won't have the bandwidth to work on it today. Feel free to push directly on my PR if that's easier.
> 
> Note that #43189 is purely optional. If you don't have time to tackle it, it's perfectly fine to keep the `"src/transformers/processing_utils.py" = ["UP045", "UP007"]` exceptions in `pyproject.toml` and handle them later.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43189). 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: audioflamingo3, auto, aya_vision, bark, beit, bit, blip, blip_2, bridgetower, chameleon, chinese_clip, clip, cohere2_vision, conditional_detr, convnext, csm
Fix generation config validation
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

Fixes an issue reported by @BenjaminBossan . The default of caching was `True` so we assume that new default of `None` is also `True`. So we need to check only if `False` is set explicitly by the user

```python
from transformers import AutoModelForCausalLM

model_id = 'hf-internal-testing/tiny-random-Gemma3ForCausalLM'
model = AutoModelForCausalLM.from_pretrained(model_id)
tmp_dirname = "/tmp/save-gemma3"
model.save_pretrained(tmp_dirname)

```


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

Oke, extending the prev test on "generation config default values"

View the CircleCI Test Summary for this PR:

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

Thanks.
Remove deprecated objects
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

As per the title. Some cleaups

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43170). 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: auto, blip, led, rag, swin, swinv2, wav2vec2

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43170&sha=f2b331
Fix failing `salesforce-ctrl`, `xlm` & `gpt-neo` model generation tests
Author: Sai-Suraj-27
Pull request: yes

# What does this PR do?

Fixes failing [salesforce-ctrl](https://github.com/huggingface/transformers/actions/runs/20706072009/job/59437072445#step:14:2512), [xlm](https://github.com/huggingface/transformers/actions/runs/20706072009/job/59437072306#step:14:1400) & [gpt-neo](https://github.com/huggingface/transformers/actions/runs/20706072009/job/59437072542#step:14:2902) models generation tests

<img width="1330" height="187" alt="image" src="https://github.com/user-attachments/assets/1f5b7904-9014-48b3-944b-67ae50a22781" />


## 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: ctrl, gpt_neo, xlm

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

models: ["models/ctrl", "models/gpt_neo", "models/xlm"]
quantizations: []

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

✅ No failing test specific to this PR 🎉 !


`run-slow` looks good! Let's add a commen then I'll merge, thx for all these PRs :heart: 

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

run-slow: ctrl, gpt_neo, xlm

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

# What does this PR do?

As per the title. All those prints does not give any useful informations and create noise
Let's print only important informations, i.e. a file has been changed, but let's not print if everything is good

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43197). 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: afmoe, apertus, arcee, aria, bitnet, blt, chameleon, csm, cwm, dbrx, deepseek_v3, dia, diffllama, doge, dots1, emu3

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43197&sha=d2db45
run all test files on CircleCI
Author: ydshieh
Pull request: yes

# What does this PR do?

Maybe we need to verify that there is at least one python files being modified.

(i.e. if only doc MD files are modified, don't run)

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43146). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Clamp temperature to >=1.0 for Dia generation
Author: Haseebasif7
Pull request: yes

# Clamp temperature to ≥ 1.0 to fix noise in Dia generation

## What does this PR do?

This PR clamps the `temperature` parameter to a minimum value of `1.0` during **Dia** model generation.

The change aligns the Transformers implementation with the original Dia reference configuration and the Nari Labs demo UI, where the temperature slider does not allow values below `1.0`. Allowing `temperature < 1.0` was found to produce unstable and noisy audio outputs, and in some cases could lead to generation failures.

By enforcing a lower bound of `1.0`, this PR:

* Prevents noisy or degraded audio generation
* Matches the behavior of the original Dia implementation and UI
* Avoids confusing or misleading semantics for users

This is a **non-breaking change**: values below `1.0` are silently clamped to `1.0`.

Fixes #43016

## 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, Pull Request section?
* [x] Was this discussed/approved via a Github issue or the forum?
  → [https://github.com/huggingface/transformers/issues/43016](https://github.com/huggingface/transformers/issues/43016)
* [x] Did you make sure to update the documentation with your changes?
  Not applicable — behavior matches upstream reference implementation.
* [x] Did you write any new necessary tests?
  Not added — this is a behavioral clamp and existing coverage is sufficient.

## Who can review?

This change affects **audio models** and **generation logic**.
Tagging the following reviewers:

* @eustlb
* @ebezzam


Library:

- generate: @zucchini-nlp (visual-language models) or @gante (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 @MekkCyber
- kernels: @MekkCyber @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:
@bot /style 

Style bot fixed some files and pushed the changes.

> Thanks ! Does this fix your issue @jiqing-feng ?

My example still outputs noise.

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

run-slow: dia

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43029). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix spelling typos in comments and code
Author: raimbekovm
Pull request: yes

Fixes several spelling typos found in comments and code:

- 'paramter' → 'parameter' in qwen2_5_omni (2 files)
- 'patterms' → 'patterns' in core_model_loading
- 'actualy' → 'actually' in generation/utils
- 'orignal' → 'original' in xcodec
- 'wether' → 'whether' in xcodec

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

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43046&sha=0188ff
[docs] llama.cpp
Author: stevhliu
Pull request: yes

- adds llama.cpp guide explaining how it uses transformers to the new community integrations section
- create separate section for deployment (more to follow soon here!)

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43185). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Torch patches tracker for HPU/Gaudi
Author: IlyasMoutawwakil
Pull request: no
Labels: name: bug

### System Info

On the Gaudi3 machine that we use for CI, we observed some limitations on a low level (torch/synapseAI) :
- `torch.Tensor.masked_fill_` operation doesn't work with int64 dtype (only on Gaudi1).
- `torch.gather` (and `torch.Tensor.gather`) operation doesn't work with int64 dtype.
- `torch.scatter` (and `torch.Tensor.scatter`) operation doesn't work when `input` tensor shares memory with `src` tensor.
- `torch.linalg.cholesky` might return nans in cases where the input matrix is "barely" positive definite, resulting in nan filled samples from the multivariate normal distribution.

Patches were introduced to bypass these issues for now but we expect them to be removed when the issues are fixed in SynapseAI/torch+hpu.

@ydshieh 

### 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:
nice! 

@IlyasMoutawwakil I delete the

```
**github-actions**

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

to keep this open.



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.
Add regression test for offline tokenizer loading (fixes #43200)
Author: Anri-Lombard
Pull request: yes

## Summary

This PR adds a regression test for issue #43200 where `AutoTokenizer.from_pretrained()` failed in offline mode (`HF_HUB_OFFLINE=1`) even when the model was cached locally.

**Good news:** The underlying bug was already fixed on main as part of the tokenizer refactoring. The `_patch_mistral_regex` function now correctly checks `is_offline_mode()` and sets `is_local = True` to prevent network calls (see `tokenization_utils_tokenizers.py` lines 1177-1178).

This PR adds a test to prevent regression.

## Root Cause (for reference)

In v4.57.3, commit d3ee5e8f14 added `_patch_mistral_regex` which called `model_info()` without handling offline mode:

```python
def is_base_mistral(model_id: str) -> bool:
    model = model_info(model_id)  # No error handling for offline mode
    ...

if _is_local or is_base_mistral(pretrained_model_name_or_path):
```

When `HF_HUB_OFFLINE=1` and using a model ID (not local path), `is_base_mistral()` was called and `model_info()` raised `OfflineModeIsEnabled`.

## The Fix (already on main)

The refactored code in `tokenization_utils_tokenizers.py` now includes:

```python
if is_offline_mode():
    is_local = True
```

This ensures `is_base_mistral()` is never called in offline mode due to short-circuit evaluation.

## Test Plan

- [x] New test `test_offline_tokenizer` passes
- [x] All existing `TestOffline` tests pass
- [x] Verified offline tokenizer loading works manually

Comments:
Document tensor parallelism configuration with Trainer
Author: Likhita-17
Pull request: yes

This PR adds a concise documentation section explaining how to configure tensor parallelism (TP) when training with `Trainer`.

It clarifies that TP must be managed by Accelerate rather than during model loading, and explains why `device_map="auto"` should not be used with distributed training. A minimal, runnable TP-only Trainer example is included.

Fixes #41141

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).

## Who can review?

@stevhliu


Comments:
> i think it's possible to just set tp_plan="auto" in from_pretrained without explicitly using ParallelismConfig. i believe Trainer creates this for you [here](https://github.com/huggingface/transformers/blob/c7e5b749a6392ea2f42fea983af41f825b0bc78d/src/transformers/trainer.py#L5098) right @SunMarc? 🙏

Yeah you can pass tp_plan="auto" which will shard the model on the gpus that you have and Trainer will create the correct ParallelismConfig. You can also pass a device_mesh created from ParallelismConfig when initializing the model. As for `device_map="auto"`, if you run it with `torchrun` it will also enable tp when loading the model. 

Thanks very much for the review and constructive feedback!

I’m happy to make the suggested adjustments:

- Move the TP configuration section under the existing Trainer optimization area as recommended.
- Add a link to the tensor parallelism docs for additional context.
- Clarify that in many cases, users can simply pass `tp_plan="auto"` in `from_pretrained()` and Trainer will create the correct parallelism configuration for TP-only training.

If it’s helpful, I can update the doc text to reflect these points — just let me know if there’s a preferred location/heading for the Trainer optimization section.

Thanks again for guiding this consolidated effort — I’m glad the content has come together nicely and addresses the original issue (#41141)!


sounds good, you can add a "tensor parallelism" section after [this](https://huggingface.co/docs/transformers/main/en/trainer#torchcompile)

Thanks for the guidance! I’ve added the Tensor Parallelism section immediately after the `torchcompile` heading. Please let me know if you'd like any refinements or additional detail.
Add output_attentions flag to DinoV3
Author: GaspTO
Pull request: no
Labels: name: Feature request

### Feature request

Hi,

I was trying to output the attention maps of **DINOv3** as it is possible for other models, such as DETR, by passing the flag `output_attentions=True` during the main call:
```
model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50")
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs, output_attentions=True)
```
But instead of DETR, I want to add for DINOV3.

Is this a good idea for a PR? I already made the changes locally, it's just about whether I open a PR.

### Motivation

Seeing the attention maps of a vision transformer, especially one trained with self-supervised learning, is a very important thing for studying and debugging it. In fact, this was shown in the paper of the first DINO model, called _Emerging Properties in Self-Supervised Vision Transformers_ , where the natural proclivity of these models to learn segmentation masks was seen in its attention maps.

I was trying to see these masks in DINOv3, but could not do it.

### Your contribution

I can do this change. In fact, it would be my first change, which would be a great introduction to, hopefully, more.

Comments:
bug in Mistral3
Author: foldl
Pull request: no
Labels: name: bug

### System Info

Universal.

### Who can help?

@yonigozlan @molbap

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

From here, we know the output hidden size of `Mistral3PatchMerger` is `vis_config.hidden_size`:

https://github.com/huggingface/transformers/blob/15b79ea808237691397be558bdebbef378b9fa35/src/transformers/models/mistral3/modular_mistral3.py#L78

But, there is expected input hidden size of linear_1 is `vis_config.hidden_size * num_feature_layers`:

https://github.com/huggingface/transformers/blob/15b79ea808237691397be558bdebbef378b9fa35/src/transformers/models/mistral3/modular_mistral3.py#L89-L90

So, with this specific `Mistral3PatchMerger`, `num_feature_layers` must be 1.

### Expected behavior

* If `num_feature_layers` is always 1, then this parameter (`num_feature_layers`) can be eliminated; (Note: recently released Ministral-3 models all use `1` for this)
* If `num_feature_layers` can be larger than 1, then current `Mistral3MultiModalProjector` is broken and needs to be fixed.

Comments:
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.