noamaanMulla-03/transformers-issues huggingface dataset:
[WIP] Add InternVL2.5 model and related components
Author: thisisiron
Pull request: yes

# What does this PR do?

add the InternVL 2.5 model.

The addition of InternVL might be redundant (see #35968).
I only discovered this while working on it.

## 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.



Comments:
Feature/standardize opt model card
Author: JoestarGagan
Pull request: yes

# What does this PR do?

This PR standardizes and enhances the documentation for the OPT model card ('docs/source/en/model_doc/opt.md'). The goal is to align it with the updated model card template (as mentioned in issue-Model cards #36979) .

## 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.
    * **No, this was a self-initiated effort to standardize the OPT model card based on the general contribution guidelines for documentation, as it is a straightforward improvement. **
- [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?
      * **N/A - This is a documentation-only change to a markdown file. ** 
## Key changes included:
* Aligned the model card to the current Hugging face template.
* Integrated new details regarding the quantization capabilities .
* Added specific, verified notes to clarify model behavior.
* Successfully passed `make style` and `make docs` locally to ensure formatting and documentation build integrity.

## 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.

@stevhliu (as this is a documentation update)


Comments:
Hi @stevhliu, updated as per the suggestions


The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39568). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Translated text-to-speech into Korean
Author: taemincode
Pull request: yes

<!-- PR의 제목은 "🌐 [i18n-KO] Translated `<your_file>.md` to Korean" 으로 부탁드립니다! -->
# What does this PR do?

Translated the `<text-to-speech>.md` file of the documentation to Korean.
Thank you in advance for your review. 

Part of https://github.com/huggingface/transformers/issues/20179

## Before reviewing
- [x] Check for missing / redundant translations (번역 누락/중복 검사)
- [x] Grammar Check (맞춤법 검사)
- [x] Review or Add new terms to glossary (용어 확인 및 추가)
- [x] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [x] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)

<!-- 1. 위 체크가 모두 완료된 뒤에, 이 아래에 리뷰를 요청할 팀원들을 멘션해주세요! -->
May you please review this PR? 
@4N3MONE, @yijun-lee, @jungnerd , @harheem

## 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#start-contributing-pull-requests),
      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? (Final)

<!-- 2. 팀원들과 리뷰가 끝난 후에만 허깅페이스 직원들에게 리뷰 요청하는 아래 주석을 노출해주세요! -->

Comments:
Update recent processors for vLLM backend
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

As peer title, models needed tiny changes here and there

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

run-slow: glm4v, perception_lm

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39583). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
🌐 [i18n-KO] Translated `text-to-speech.md` to Korean
Author: taemincode
Pull request: yes

<!-- PR의 제목은 "🌐 [i18n-KO] Translated `<your_file>.md` to Korean" 으로 부탁드립니다! -->
# What does this PR do?

Translated the `<text-to-speech>.md` file of the documentation to Korean.
Thank you in advance for your review. 

Part of https://github.com/huggingface/transformers/issues/20179

## Before reviewing
- [x] Check for missing / redundant translations (번역 누락/중복 검사)
- [x] Grammar Check (맞춤법 검사)
- [x] Review or Add new terms to glossary (용어 확인 및 추가)
- [x] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [x] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)

<!-- 1. 위 체크가 모두 완료된 뒤에, 이 아래에 리뷰를 요청할 팀원들을 멘션해주세요! -->
May you please review this PR? 
@4N3MONE, @yijun-lee, @jungnerd , @harheem

## 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#start-contributing-pull-requests),
      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? (Final)

<!-- 2. 팀원들과 리뷰가 끝난 후에만 허깅페이스 직원들에게 리뷰 요청하는 아래 주석을 노출해주세요! -->

Comments:
[serve] Add speech to text (`/v1/audio/transcriptions`)
Author: gante
Pull request: yes

# What does this PR do?

This PR:
- Adds `/v1/audio/transcriptions`, the speech to text (transcription) OAI API
- Adds `TimedModel`: models get deleted from memory after a certain amount of time (e.g try launching the server as `transformers serve --enable-cors --log-level debug --model-timeout 10`)

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

# What does this PR do?

WIP, needs #39454 to be merged first.

This PR adds speech-to-text (i.e. `v1/audio/speech`) to `transformers serve`.

⚠️ So far, I've only tested it with `sesame/csm-1b`. Won't probably work with other models atm, as each model has different processing abstractions

Comments:
Adding support for Gemma 3n GGUFs
Author: minhnguyenhoang
Pull request: no
Labels: name: Feature request

### Feature request

There are now quantised GGUF versions of Gemma 3n models available on Hugging Face (e.g. https://huggingface.co/unsloth/gemma-3n-E2B-it-GGUF). Currently they can be run with other backends, but I'd like to have support for them with the `transformers` library.

If I run:
```python
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "unsloth/gemma-3n-E2B-it-GGUF"
gguf_file = "gemma-3n-E2B-it-Q4_K_M.gguf"

tokenizer = AutoTokenizer.from_pretrained(model_id, gguf_file=gguf_file)
model = AutoModelForCausalLM.from_pretrained(
        model_id,
        gguf_file=gguf_file,
        torch_dtype=torch.bfloat16,
        low_cpu_mem_usage=True)
```
It will return a `ValueError: GGUF model with architecture gemma3n is not supported yet.`

Side note: in my real implementation of this code I actually have the model downloaded manually from HF then used. However, the end result should be the same and replicable - the error doesn't suggest that my code has a bug.

### Motivation

I want to use the transformers backend to inference with this model, but I also want to use the GGUF models instead of the tensor version.

### Your contribution

I have minimal experience in AI/ML in general, but if there are resources/examples on previous works similar to this I'm willing to have a try at submitting a PR.

Comments:
Use gemma3nforcausal instead:
from transformers.models.gemma3n import Gemma3nForCausalLM
VoxtralForConditionalGeneration import error
Author: xinkez
Pull request: no
Labels: name: bug

name: Audio

### System Info

Hi,
I use the latest codes from the main branch (install by "pip install git+https://github.com/huggingface/transformers"). When I try to import VoxtralForConditionalGeneration using "from transformers import VoxtralForConditionalGeneration", it outputs errors as below

from transformers import VoxtralForConditionalGeneration, AutoProcessor
ImportError: cannot import name 'VoxtralForConditionalGeneration' from 'transformers'


Thanks in advance.

### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

1. pip install git+https://github.com/huggingface/transformers"
2. python3
3. from transformers import VoxtralForConditionalGeneration

### Expected behavior

Success

Comments:
cc @eustlb 

Try by yourself:
```bash
conda create -n test -y python=3.12 ; conda activate test ; uv pip install git+https://github.com/huggingface/transformers
python -c "from transformers import VoxtralForConditionalGeneration"
```
Works fine 😉 you must have an issue with your environment and PATH resolution, (here I would guess `pip` not pointing to same as `python3`, use `pip3` maybe).
Closing.
Gemma bug fixes - Approx GELU, Layernorms, Sqrt(hd)
Author: danielhanchen
Pull request: yes

Just a few more Gemma fixes :) Currently checking for more as well! All fixes are derived from Unsloth's 2.5x faster and 70% less VRAM Gemma finetuning script :) https://github.com/unslothai/unsloth

Related PR: https://github.com/huggingface/transformers/pull/29285, which showed RoPE must be done in float32 and not float16, causing positional encodings to lose accuracy. @ArthurZucker @younesbelkada

### 1. Approx Gelu and not Exact
Activation function according to https://twitter.com/danielhanchen/status/1763613620909580505 (waiting for confirmation) should be approximate gelu and not exact gelu. Ie `gelu` should actually be `gelu_pytorch_tanh` which calls `PytorchGELUTanh` and that calls `nn.functional.gelu(input, approximate="tanh")`. `gelu` calls `nn.functional.gelu(input, approximate="none")`
![Approx_Gelu_MqgVNPUOIJJL0PByVo10d](https://github.com/huggingface/transformers/assets/23090290/779698f7-995f-4f39-98d6-ba402319cb6e)

### 2. Layernorm (w+1) should be done in float32
The layernorms must be upcasted to float32 and not bfloat16 or float16 halfway. It must be done unlike Llama’s RMS Layernorm which downcasted before multiplying by the weights. We must downcast at the end.
![RMS_Layernorm_IQDKDDYqOynaWPbbJT71e](https://github.com/huggingface/transformers/assets/23090290/93ec2366-7c80-496d-a000-5d9e6e6f310b)

### 3. sqrt(3072)=55.4256 but bfloat16 is 55.5
Interestingly, Gemma multiplies the embeddings by sqrt(hidden_dim). However, there is a precision problem! Gemma uses jnp.sqrt(self.embed_dim) .astype(x.dtype) which means sqrt(3072) = 55.4256, but casting it to bfloat16 rounds it to 55.5. For Gemma 2b, sqrt(2048) = 45.2548, but casting it to bfloat16 makes it 45.25.
![Embedding_i3Hbs2CnyVrNF-otch_tL](https://github.com/huggingface/transformers/assets/23090290/1b2370e5-3782-482e-8220-74259f862314)


Comments:
Actually I just noticed this requires updating all of Gemma's models on the HF Model Hub: https://huggingface.co/google/gemma-7b/blob/main/config.json for eg `gelu` should be changed to `gelu_pytorch_tanh`.

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

Closing this since we merged this! Thanks everyone!

@danielhanchen Many thanks for the fixes. Do you observe any performance difference before and after this fix? thanks.
Fix: allow Union[str, dict, None] fields like deepspeed to be passed via CLI
Author: JH-debug
Pull request: yes

This PR fixes an issue in `HfArgumentParser` that causes a `ValueError` when parsing fields of type Union[str, dict, None] from the command line, such as the `deepspeed` argument in TrainingArguments.

The original parser rejected this valid type signature, even though it is commonly used to support both JSON config files (via path strings) and dictionary input. This PR adds a specific check to treat such fields as str when parsed via CLI, while still allowing JSON/dict parsing from file-based or programmatic inputs.

### Motivation & Context
When passing `--deepspeed path/to/ds_config.json` from the CLI, the parser raised the following error:

```ValueError: Only Union[X, NoneType] (i.e., Optional[X]) is allowed for Union ...```

This was because `Union[str, dict, None]` didn't meet the parser’s strict rule of "only one type allowed" in unions. However, this pattern is standard in transformers for flexible inputs (e.g., both string path and dict configs).

This patch modifies HfArgumentParser._parse_dataclass_field() to detect this specific case and allow it.

### Fixes
Closes a CLI parsing limitation for common use cases involving fields like:

`deepspeed: Optional[Union[str, dict]] = field(default=None, ...)`


Comments:
Makes sense, but please check the CI! It seems like a lot of tests are broken, so you might have to iterate on this to get it to pass. Also, you can resolve the quality issues with `pip install -e .[quality]` followed by `make fixup`.
[timm] new timm pin
Author: gante
Pull request: yes

# What does this PR do?

Updates the pin in timm to allow the latest version (1.0.19), but excludes a version that's incompatible with older python versions (1.0.18).

NOTE: `timm==1.0.18` is causing red CI e.g. [here](https://app.circleci.com/pipelines/github/huggingface/transformers/139243/workflows/33c8dbbb-e29b-429c-8cfb-61e28591f902/jobs/1845235/steps) 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39640). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix EfficientLoFTR model id in tests
Author: sbucaille
Pull request: yes
Labels: name: Vision

# What does this PR do?

Fix the incorrect model id in the tests

## 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.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?

## Who can review?

@qubvel 

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

run-slow: efficientloftr

run-slow: efficientloftr

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

models: ['models/efficientloftr']
quantizations: [] ...

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

# What does this PR do?

Values where computed on H100, here are the A10 ones for our CI runners!

Comments:
run-slow: voxtral

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

models: ['models/voxtral']
quantizations: [] ...

run-slow: voxtral

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

models: ['models/voxtral']
quantizations: [] ...

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

run-slow: voxtral

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

models: ['models/voxtral']
quantizations: [] ...

run-slow: voxtral

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

models: ['models/voxtral']
quantizations: [] ...

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

run-slow: voxtral
[qwen2 vl] fix packing with all attentions
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

As per title, and let's merge https://github.com/huggingface/transformers/pull/39341/files first. Added tests to make sure it works. If users want to use packing with any of the attentions, it is their responsibility to prepare correct position ids, since Qwen-VL needs positions for all vision grids



Fixes https://github.com/huggingface/transformers/issues/39400, https://github.com/huggingface/transformers/issues/38007

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

run-slow: qwen2_5_vl

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

models: ['models/qwen2_5_vl']
quantizations: [] ...

run-slow: qwen2_5_omni, qwen2_5_vl, qwen2_vl

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

models: ['models/qwen2_5_omni', 'models/qwen2_5_vl', 'models/qwen2_vl']
quantizations: [] ...

run-slow: qwen2_5_omni, qwen2_5_vl, qwen2_vl

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

models: ['models/qwen2_5_omni', 'models/qwen2_5_vl', 'models/qwen2_vl']
quantizations: [] ...

run-slow: qwen2_5_omni, qwen2_5_vl, qwen2_vl

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

models: ['models/qwen2_5_omni', 'models/qwen2_5_vl', 'models/qwen2_vl']
quantizations: [] ...

run-slow: qwen2_5_omni, qwen2_5_vl, qwen2_vl

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

models: ['models/qwen2_5_omni', 'models/qwen2_5_vl', 'models/qwen2_vl']
quantizations: [] ...

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

run-slow: qwen2_5_omni, qwen2_5_vl, qwen2_vl

Thanks, let's merge and I will fix SDPA/eager packing tests for all other models in subsequent PRs. We never had tests so it's failing for ~10-15 models now 👀  I marked it as slow to not ruin CI

When can we expect a new release of transformers that includes this fix?



Release is planned for tomorrow

> Release is planned for tomorrow

That would be great! VERL + SGLang Community really need it, thanks a lot!
I-BERT: expected str, bytes or os.PathLike object, not NoneType
Author: fdlci
Pull request: no

Hi, I have an issue when running this code provided by the HF documentation:
>>> from transformers import RobertaTokenizer, IBertForTokenClassification
>>> import torch

>>> tokenizer = RobertaTokenizer.from_pretrained('kssteven/ibert-roberta-base')

When running this i get the following error for the tokenizer:
TypeError: expected str, bytes or os.PathLike object, not NoneType

Comments:
Hi! I believe this checkpoint does not have a slow tokenizer, only a fast tokenizer. Can you try with:

```py
from transformers import RobertaTokenizerFast
tokenizer = RobertaTokenizerFast.from_pretrained('kssteven/ibert-roberta-base')
```

Thank you! It loaded the tokenizer without showing an error.

> Hi! I believe this checkpoint does not have a slow tokenizer, only a fast tokenizer. Can you try with:
> 
> from transformers import RobertaTokenizerFast
> tokenizer = RobertaTokenizerFast.from_pretrained('kssteven/ibert-roberta-base')

I come up with the same problem ，how to solve it？
The model link is "https://huggingface.co/ValkyriaLenneth/longformer_zh/tree/main"
<img width="1327" height="627" alt="Image" src="https://github.com/user-attachments/assets/e4461ef6-6ce9-4ef5-be15-36f1b393bb5f" />
[Fast Processor] OWLv2
Author: Reshan123
Pull request: yes

# What does this PR do?
Adding fast processor for OWLv2

Linking: https://github.com/huggingface/transformers/issues/36978

# 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.

CC: @yonigozlan 

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers and trigger CI.

Closing as completed in https://github.com/huggingface/transformers/pull/39041
fix: typo in transcription-related method names across Voxtral model …
Author: blakkd
Pull request: yes

Fixe misspelled `apply_transcrition_request` to `apply_transcription_request` in:
- Documentation (`voxtral.md`)
- Processor implementation (`processing_voxtral.py`)
- Test files (`test_modeling_voxtral.py`)

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

run-slow: voxtral

Sorry, duplicate of #39572
Default processor message
Author: molbap
Pull request: yes

# What does this PR do?

Small PR adding a `.default_message` method to all multimodal processors. Handles just image and text input for now, expandable to videos if there's interest. 

Example usage:

<img width="1099" height="481" alt="image" src="https://github.com/user-attachments/assets/96b6197f-795f-4326-b6f3-49e767620215" />


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

Hey, sure! Initially I had put it in the visualizer and thought maybe to move it to the processor API, but it's indeed already quite full. Closing this one, I'll put this feature in the other viz. Thanks for the review!
[attention] fix test for packed padfree masking
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

As per title, I added the test a few days ago as slow, so I can fix them later for all models


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39582). 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: bark, chameleon, emu3, fuyu, gemma3, kosmos2, llava, minimax, paligemma, paligemma2, persimmon, qwen2_5_omni, qwen2_5_vl, qwen2_vl, voxtral