noamaanMulla-03/transformers-issues huggingface dataset:
Ignore decoder_inputs_embeds when decoder_input_ids are present (fixes #39542)
Author: JoseAlvarezMedina
Pull request: yes

Fixes #39542

### What does this PR do?

When using a custom seq2seq model together with PEFT/LoRA, both `decoder_input_ids` and `decoder_inputs_embeds` can end up being passed to the underlying decoder. This triggers the internal validation:

ValueError: You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time


This PR adds a small defensive override in `Seq2SeqTrainer.compute_loss` that drops `decoder_inputs_embeds` when `decoder_input_ids` are also present. This keeps backward compatibility and mirrors the user expectation that `decoder_input_ids` should take precedence.

### Implementation details

```python
if "decoder_input_ids" in inputs and "decoder_inputs_embeds" in inputs:
    inputs.pop("decoder_inputs_embeds")
A new test tests/trainer_seq2seq_test.py builds a small Marian model, simulates the conflicting inputs and verifies that training progresses without raising the exception.

Motivation
This pattern appears in real-world usage when composing an encoder from one model and a Marian (or similar) decoder while applying PEFT/LoRA. Making the Trainer resilient avoids forcing each user to patch their own subclass.

Tests
pytest tests/trainer_seq2seq_test.py -q passes locally.

Additional notes
Happy to adjust the location of the guard (e.g. move it to the base Trainer) if reviewers prefer.

Who can review?
Tagging trainer maintainers for visibility: @zach-huggingface @SunMarc



Comments:
It's unclear that this fixes the issue! Please don't run code agents on user issues when the cause hasn't been fully identified, they have a strong tendency to fix the wrong thing.
Add AMD test expectations to DETR model
Author: ahadnagy
Pull request: yes

# What does this PR do?

This model adds the correct test expectations for AMD hardware to the DETR model.


## 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://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?

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
- vision models: @amyeroberts, @qubvel
- speech models: @eustlb
- graph models: @clefourrier

Library:

- flax: @gante and @Rocketknight1
- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- pipelines: @Rocketknight1
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @zach-huggingface, @SunMarc and @qgallouedec
- chat templates: @Rocketknight1

Integrations:

- deepspeed: HF Trainer/Accelerate: @SunMarc @zach-huggingface
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc @MekkCyber

Documentation: @stevhliu

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @Rocketknight1
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


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

cc @remi-or 

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

run-slow: detr
Is the new Intel–Weizmann speculative decoding algorithm integrated into Transformers?
Author: NEWbie0709
Pull request: no

Hi,

I recently read about a new speculative decoding algorithm developed by Intel Labs and the Weizmann Institute, which reportedly improves inference speed by up to 2.8×, even when using draft and target models with different vocabularies or architectures.

References:

- [Intel Newsroom](https://newsroom.intel.com/artificial-intelligence/intel-weizmann-institute-speed-ai-with-speculative-decoding-advance?utm_source=chatgpt.com)
- [CTech Article](https://www.calcalistech.com/ctechnews/article/h1z7pydlex)

Several sources (including Intel press releases and third-party writeups) claim that this algorithm has already been integrated into the Hugging Face Transformers library.
However, I haven’t found any reference to this new version in the official Transformers documentation


My Questions:

1. Has this Intel–Weizmann speculative decoding algorithm actually been integrated into transformers?
2. If so, where can I find documentation or usage examples for how to enable it?

Thanks in advance for your help! This looks like a powerful advancement, and I'd love to test it.

Comments:
Hi @NEWbie0709, I **think** this is universal assisted decoding: https://huggingface.co/blog/jmamou/uag-tli

@Rocketknight1  Thanks a lot for the information. 😄 

@Rocketknight1  But can I ask why the [article ](https://arxiv.org/pdf/2502.05202)was only few months ago, even though UAG speculative decoding has been around since October last year?

Not sure! They might have updated the algorithm slightly. cc @gante, do you know?
[docs] update attention implementation and cache docs
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

As per title, and we will delete `Legacy cache format` section in 2-3 releases when all legacy support is removed. 

This PR:
- Adds docs on multimodal attention implementation setting
- Cross references attn implementation docs in other pages. I didn't know that docs page existed and searching for FA2/SDPA usually doesn't return it. Let's make it more discoverable
- Adds a section on what is cache position, as reported by many users concept of `cache position` is still confusing. We can add later more examples, I remember @gante had a PR on fixing generate when cache position is provided by users :) 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39547). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[docs] Create page on inference servers with transformers backend
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

As per title, I added the basic info about existing inference engines so feel free to add more examples/tips etc. This PR creates a space where we can host docs on all third-party servers and we can submit PRs in vLLM/SGLang/TGI pointing to this page

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39550). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Add AMD expectations to Mistral3 tests
Author: ahadnagy
Pull request: yes

# What does this PR do?

This PR adds the correct expectations for AMD devices in the Mistral3 tests.

## 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://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?

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
- vision models: @amyeroberts, @qubvel
- speech models: @eustlb
- graph models: @clefourrier

Library:

- flax: @gante and @Rocketknight1
- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- pipelines: @Rocketknight1
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @zach-huggingface, @SunMarc and @qgallouedec
- chat templates: @Rocketknight1

Integrations:

- deepspeed: HF Trainer/Accelerate: @SunMarc @zach-huggingface
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc @MekkCyber

Documentation: @stevhliu

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @Rocketknight1
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


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

run-slow: mistral3

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39481). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Add AMD GPU expectations for LLaVA tests
Author: ahadnagy
Pull request: yes

# What does this PR do?

This PR adds the correct output expectations for AMD GPUs to the LLaVA tests.


## 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://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?

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
- vision models: @amyeroberts, @qubvel
- speech models: @eustlb
- graph models: @clefourrier

Library:

- flax: @gante and @Rocketknight1
- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- pipelines: @Rocketknight1
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @zach-huggingface, @SunMarc and @qgallouedec
- chat templates: @Rocketknight1

Integrations:

- deepspeed: HF Trainer/Accelerate: @SunMarc @zach-huggingface
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc @MekkCyber

Documentation: @stevhliu

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @Rocketknight1
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39486). 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: llava
General weight initialization scheme 
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

As per the title. Models with standard init scheme should not always have te redefine it. This cleans-up quite a lot of code in the modelings

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39579). 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: aimv2, arcee, aria, aya_vision, bamba, biogpt, bitnet, chameleon, cohere, cohere2, csm, deepseek_v2, deepseek_v3, dia, diffllama, doge
Update `docs/source/ko/_toctree.yml`
Author: jungnerd
Pull request: yes

# What does this PR do?
Updated the outdated `docs/source/ko/_toctree.yml` and reorganized the file locations accordingly.


<!-- Remove if not applicable -->

Part of https://github.com/huggingface/transformers/issues/20179


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] 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.
- [x] 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?

Hi @stevhliu 👋
I modified `docs/source/ko/_toctree.yml` because the table of contents of the Korean documentation was outdated.
May you please review this PR?


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39516). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[Paged-Attention] Handle continuous batching for repetition penalty
Author: kashif
Pull request: yes

# What does this PR do?

We handle the repetition penalty for continuous batching

Fixes # (issue)


## 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://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?

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
- vision models: @amyeroberts, @qubvel
- speech models: @eustlb
- graph models: @clefourrier

Library:

- flax: @gante and @Rocketknight1
- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- pipelines: @Rocketknight1
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @zach-huggingface, @SunMarc and @qgallouedec
- chat templates: @Rocketknight1

Integrations:

- deepspeed: HF Trainer/Accelerate: @SunMarc @zach-huggingface
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc @MekkCyber

Documentation: @stevhliu

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @Rocketknight1
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


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

Thanks!
Torchdec RuntimeError catch 
Author: SunMarc
Pull request: yes

# What does this PR do ? 

This PR fixes an issue with torchcodec in print_env.py. We forgot to deal with the case where torchcodec raises a RuntimeError error. Currently some of our training [ci](https://github.com/huggingface/transformers/actions/runs/16433389284/job/46438805785) are not running because of that. 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39580). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix link in "Inference server backends" doc
Author: hmellor
Pull request: yes

The link now points to the correct place in the vLLM docs

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39589). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
CI skipped failures tracking issue
Author: ivarflakstad
Pull request: no

Some of the tests in our scheduled CI's are skipped because they require newer hardware (higher compute capability) than the setup we are currently using. That's not a problem on it's own, but after manually checking we have found that there are actually quite a few of these tests that fail on the hardware that can run said tests.

This issue is to be used to track work related to this category of tests.

The first step will be to skip said tests in the CI and add a reference to this issue in the reason for skipping.

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.
Fix DynamicCache and simplify Cache classes a bit
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

As per the title. DynamicCache was broken because `self.layers` needs to exist if we want to append to it -> `test_multi_gpu_data_parallel_forward` was failing

cc @manueldeprada for viz

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

No no it has nothing to do with hardware here - you cannot append if the list does not exist

I know! I was mentioning that as a reason for the test to be skipped in the PR tests (since it requires multigpu)

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

run-slow: bamba, granitemoehybrid, jamba
Generic task-specific base classes
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

As per the title. The easiest and most general approach is to use abstract classes where everything is defined, similar to a Mixin. That way we don't need to redefine the same every time, but it still appears explicitly in the modeling, and we have no conflicts with the current classes in the public imports

On the road for the great unbloating!



Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39584). 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: arcee, aria, deepseek_v2, deepseek_v3, diffllama, doge, gemma, gemma2, glm, glm4, glm4_moe, granite, helium, jamba, jetmoe, lfm2
Rename `supports_static_cache` to `can_compile_fullgraph`
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

As per title, let's be specific about how the attribute is used. I will see if we can entirely get rid of the flag, maybe there's another way to infer which models support compile or not. At least from what I know, all MoE and non-transformer arch models don't support it

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39505). 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: arcee, aria, aya_vision, bart, bigbird_pegasus, biogpt, bitnet, blenderbot, blenderbot_small, blip_2, bloom, chameleon, codegen, cohere, cohere2, csm