noamaanMulla-03/transformers-issues huggingface dataset:
Facing AttributeError: "FlaxDinov2SwiGLUFFN" object has no attribute "hidden_features".
Author: premmurugan229
Pull request: no
Labels: name: Flax

name: bug

### System Info

While running Dinov2 model in Flax for giant variant, I am encountering an error as
 
> AttributeError: "FlaxDinov2SwiGLUFFN" object has no attribute "hidden_features".
 
There should be a typo [here](https://github.com/huggingface/transformers/blob/72e4844059cf0d7d01f0dfca20a9834cef82c133/src/transformers/models/dinov2/modeling_flax_dinov2.py#L406).
 
FlaxDinov2SwiGLUFFN config doesn't have hidden_features attribute. Instead we should use the previously calculated hidden_feature value.
 
#### I would like to contribute for this issue.
 
My environment details are as below :
 
> transformers version: 4.51.3
> Platform: Linux-5.4.0-212-generic-x86_64-with-glibc2.35
> Python version: 3.10.12
> Huggingface_hub version: 0.30.2
> Safetensors version: 0.5.3
> Accelerate version: not installed
> Accelerate config: not found
> DeepSpeed version: not installed
> PyTorch version (GPU?): 2.6.0+cu124 (False)
> Tensorflow version (GPU?): not installed (NA)
> Flax version (CPU?/GPU?/TPU?): 0.10.4 (cpu)
> Jax version: 0.5.0
> JaxLib version: 0.5.0

 I am attaching screenshot for reference

![Image](https://github.com/user-attachments/assets/d09b3da1-a77a-4bd0-bc34-d2fd18b255c3)

### Who can help?

@gante @Rocketknight1 

This issue is faced for Flax implementation of Dinov2 variant

### Information

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

### Tasks

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

### Reproduction

Steps to recreate the error:

run the below code in any python editor

```
from transformers import AutoImageProcessor, FlaxDinov2ForImageClassification
from PIL import Image
import jax
import requests
 
url = "[http://images.cocodataset.org/val2017/000000039769.jpg"](http://images.cocodataset.org/val2017/000000039769.jpg%22)
image = Image.open(requests.get(url, stream=True).raw)
 
image_processor = AutoImageProcessor.from_pretrained("facebook/dinov2-giant")
model = FlaxDinov2ForImageClassification.from_pretrained("facebook/dinov2-giant", from_pt=True)
```

### Expected behavior

The model should run and produce an error free output with basic example

Comments:
Fix tied weight loading with TP and loading sub state_dicts
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

See https://github.com/huggingface/transformers/issues/37737

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.

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

# What does this PR do?
Fixes `auto-round` docs using `hfoption`


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.

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

# What does this PR do?

Update the model card for Gemma  #36979 

## Before submitting
- [x] 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.
@stevhliu


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.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_37674). 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 `roberta.md` to Korean
Author: garongkim
Pull request: yes

<!-- PR의 제목은 "🌐 [i18n-KO] Translated `<your_file>.md` to Korean" 으로 부탁드립니다 -->
# What does this PR do?

Translated the `roberta.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
- [ ] Check for missing / redundant translations (번역 누락/중복 검사)
- [ ] Grammar Check (맞춤법 검사)
- [ ] Review or Add new terms to glossary (용어 확인 및 추가)
- [ ] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [ ] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)

<!-- 1. 위 체크가 모두 완료된 뒤에만 본인의 조 팀원들에게 리뷰 요청하는 아래 주석을 노출해주세요!-->
May you please review this PR?
<!-- @cjfghk5697, @yijun-lee, @rlaalsrl0922 , @MinJu-Ha -->
<!-- @cjfghk5697, @yijun-lee, @devxaitist, @nsbg -->
<!-- @cjfghk5697, @yijun-lee, @Kim-Ju-won @junhkang @olccihyeon -->
<!-- @cjfghk5697, @yijun-lee, @garongkim @maximizemaxwell -->

## 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#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.
- [ ] 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. N조 팀원들과 리뷰가 끝난 후에 아래 주석을 노출해주세요! -->
<!-- @stevhliu May you please review this PR? -->

Comments:
cc @stevhliu 

> Thanks for your translation! Remember to tag someone who can read Korean to review your translation
> 
> cc @jungnerd or @4N3MONE, would you mind quickly reviewing please? 🤗

Sure! Feel free to tag me anytime you need a review on Korean document! 🤗

Thanks @jungnerd and @4N3MONE, appreciate you!

@garongkim, can you update your branch to fix the `build_pr_documentation` test please? Feel free to mark your PR as ready for review once you're done 🤗 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_37069). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix qwen2_5 get_rope_index tensor device locations
Author: rphmeier
Pull request: yes

# What does this PR do?

This fixes the torch device mismatch errors in the Qwen-2.5 integration when applied to video inputs.
Before, tensors were mixed between the CPU and cuda devices, leading to runtime errors: `RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument tensors in method wrapper_CUDA_cat)`

These codepaths were only taken when video inputs were supplied, but were always taken when following the instructions and example code on the huggingface hub. For example, the sample code in the [Qwen 2.5 7B Instruct Video Inference section](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) would unconditionally fail. 

## 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.
- [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?


Tagging these people at the suggestion of the 
- text models: @ArthurZucker
- vision models: @amyeroberts, @qubvel

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.

Sure, I will attempt that. 

OK, I have pushed a slow test for doing video vision inference. 

My previous patch also broke a bunch of other tests, because the type of `second_per_grid_t` was an int in some cases and this caused `.to()` to fail. So I changed the fix to use `torch.as_tensor` to normalize the type. Now all tests pass, though some of the existing slow tests seem broken independently.

I've also now pushed a test which is at least close to working, just for the model. It took me some time to understand the expected input data formats.

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

### System Info

- `transformers` version: 4.51.3
- Platform: Linux-6.8.0-52-generic-x86_64-with-glibc2.35
- Python version: 3.11.9
- Huggingface_hub version: 0.30.2
- Safetensors version: 0.5.3
- Accelerate version: 1.6.0
- Accelerate config:    not found
- DeepSpeed version: not installed
- PyTorch version (GPU?): 2.4.1+cu121 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA GeForce RTX 4090

### Who can help?

@zach-huggingface @SunMarc

### Information

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

### Tasks

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

### Reproduction

It looks like `split_batches` in `Seq2SeqTrainingArguments` was deprecated and removed in this [PR](https://github.com/huggingface/transformers/pull/36946) but it still exists in the newest [doc](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.Seq2SeqTrainingArguments) and error message 
```
RuntimeError: You can't use batches of different size with `dispatch_batches=True` or when using an `IterableDataset`.either pass `dispatch_batches=False` and have each process fetch its own batch  or pass `split_batches=True`. By doing so, the main process will fetch a full batch and slice it into `num_processes` batches for each process
```

Passing in the argument will result in an error `Seq2SeqTrainingArguments.__init__() got an unexpected keyword argument 'split_batches`



### Expected behavior

Error messages similar to warning messages in the previous version 
```
FutureWarning: Using `--split_batches` is deprecated and will be removed in version 4.41 of 🤗 Transformers. Use `--accelerator_config {'split_batches':VALUE} instead
```

Comments:
nevermind, I didn't see the part where it's moved inside `accelerator_config` now, sorry about that.
[Install] fail to install pip install transformers==4.42
Author: vfdff
Pull request: no
Labels: name: bug

### System Info

python 3.9

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

According to https://github.com/huggingface/transformers/issues/31806, the transformer version 4.42.3 is matched to python 3.9, so I try to install it  with **pip install transformers==4.42** .

It report errors (machine 131)
```
(py2.1-zyd) [ma-user llama149]$**pip install transformers==4.42**
Looking in indexes: https://pip.modelarts.private.com/repository/pypi/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0xffff82fdd4c0>, 'Connection to openproxy.huawei.com timed out. (connect timeout=120.0)')': /repository/pypi/simple/transformers/
```

But it can successfully installed with **pip install transformers**
```
(py2.1-zyd) [ma-user llama149]$pip install transformers
Looking in indexes: https://pip.modelarts.private.com/repository/pypi/simple
Requirement already satisfied: transformers in /home/ma-user/work/zhongyunde/envs/py2.1-zyd/lib/python3.9/site-packages (4.44.2)
```

### Expected behavior

successfully install the special version transformer version 4.42

Comments:
The above issue may be related no network config as I can use **pip install transformers==4.44.2** on another 46 machine, so clone it.  

> refer to: https://gitee.com/ascend/pytorch/issues/IC3T4W?from=project-issue
[causal mask] fix preparation with multi-gpu
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

Fixes https://github.com/huggingface/transformers/issues/37606

Happens when `cache_position` and `inputs_embeds` are in different devices which doesn't affect LMs. It affects multimodal models only when multimodal encoder size is big and is allocated to the first device, so `embed_tokens` gets allocated to the next device (`idx=1`). The error will be triggered whenever a batched input is used, where `causal_mask` has to be built instead of  being `None`

We can also modify only VLMs `_update_causal_mask` but I think it's easier if we have one source of truth (llama) from where everything is copied. The current fix doesn't change anything for LMs, where  `cache_position` and `inputs_embeds` are always in same device

Added a small test that will fail on current `main`, tests failing in CI currently are not related. Reviewers can look only at `llama` and `utils`, other files are copied from



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.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_37612). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Source link to Ray Tune API outdated
Author: JoshuaEPSamuel
Pull request: no

Was reading the TrainingArguments documentation when I came across the param `ray_scope`:
https://huggingface.co/docs/transformers/en/main_classes/trainer#transformers.TrainingArguments.ray_scope

Current hyperlink to Ray documentation no longer exists:
https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial

I've found the new hyperlink to replace with:
https://docs.ray.io/en/latest/tune/api/doc/ray.tune.ExperimentAnalysis.get_best_trial.html

Comments:
I will solve this issue

Yes, if someone could make a PR to fix this, that would be great! Please tag `stevhliu` for review.

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.
could not parse ModelProto from /home/imss/zxhhhh/llama-3-8b/tokenizer.model
Author: ZhangXiaohan-TJU
Pull request: no
Labels: name: bug

### System Info

could not parse ModelProto from /home/imss/zxhhhh/llama-3-8b/tokenizer.model

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

sp_model = SentencePieceProcessor()
sp_model.Load("/home/imss/zxhhhh/llama-3-8b/tokenizer.model")

### Expected behavior

who can help me

Comments:
Could you give a more elaborate description of the problem? It could be helpful to understand.

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.
unpin pytest<8
Author: ydshieh
Pull request: yes

# What does this PR do?

unpin pytest<8 to see if we get rid of 

> Too long with no output (exceeded 10m0s): context deadline exceeded

as discussed internally https://huggingface.slack.com/archives/C01NE71C4F7/p1745514692206779?thread_ts=1745423231.198669&cid=C01NE71C4F7

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.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_37768). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Align gpt2 mask preparation to #37612
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

Align gpt2. This was a race condition in merging order of https://github.com/huggingface/transformers/pull/37612 and https://github.com/huggingface/transformers/pull/35761
It causes the following error https://app.circleci.com/pipelines/github/huggingface/transformers/128019/workflows/ba65aabf-d3a9-4750-b3f6-b264aa3c5bce/jobs/1715832

cc @zucchini-nlp to double-check!

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.

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

# What does this PR do?

As per the title. https://github.com/huggingface/transformers/pull/37719 missed one location. Also fixes https://github.com/huggingface/transformers/issues/37765


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.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_37790). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Leaving model loaded in memory for an inference server causes CUDNN to crash if left alone for awhile - need help making sense of what's happening
Author: rperdon
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.51.3
- Platform: Linux-5.15.0-1042-nvidia-x86_64-with-glibc2.35
- Python version: 3.10.12
- Huggingface_hub version: 0.30.2
- Safetensors version: 0.5.3
- Accelerate version: 1.6.0
- Accelerate config:    not found
- DeepSpeed version: not installed
- PyTorch version (GPU?): 2.6.0+cu124 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA A100-SXM4-40GB


### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [x] 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

https://huggingface.co/huihui-ai/Qwen2-VL-2B-Instruct-abliterated


Created a docker environment to run CUDA. 

Taken this code and run into a flask application run in waitress.

Run inference on an image 

Wait. In my case it's leaving it alone for a day, but I will try to test how long before it dies. Try inference again and it crashes

I'm not seeing any more memory increase in GPU than after it was loaded with nvidia-smi.

Every 5.0s: free -m                                                            dgxa100: Thu Apr 17 15:27:36 2025

               total        used        free      shared  buff/cache   available
Mem:         1031854      205868      668095        3939      157889      816722
Swap:              0           0           0

Main memory available prior to launching app.



### Expected behavior

After some time CUDNN crashes and does not do inference anymore.

![Image](https://github.com/user-attachments/assets/0af5607e-86c7-4029-8ef3-9ddd0aa37c89)

If I try to relaunch the application:

![Image](https://github.com/user-attachments/assets/16f7d757-dcbb-40d1-aa20-5347021923a0)

I am forced to exit my docker container. My other docker containers are unaffected and continuing to run. I need to relaunch my docker container to be able to run the app and model for inference again.

Comments:
Allocated memory is important to note with this model. If you have 2 models loaded which call for allocated memory larger than available, CUDNN seems to crash out hard for both models and neither are returned to the docker container correctly forcing a container restart.