noamaanMulla-03/transformers-issues huggingface dataset:
HTML Files Keep on Loading
Author: IsaacZachary
Pull request: no

### Feature request

The HTML files for the support files are not opening it keeps loading to infinity
![image](https://github.com/huggingface/transformers/assets/66381599/b2d97306-c1a4-42af-80ec-352f1da19568)


### Motivation

I'm trying to access the site but I can see anything every tab I click just keeps loading

### Your contribution

---

## Fixing "Failed to load resource: net::ERR_FILE_NOT_FOUND" Error

If you encounter the "Failed to load resource: net::ERR_FILE_NOT_FOUND" error in your web application, follow these steps to resolve it:

1. **Check File Paths**: Ensure that the file specified in the error message (`preloader.js` in this case) exists at the correct path relative to the HTML file that references it. Verify the file path in your HTML code.

2. **Confirm File Existence**: Double-check that the `preloader.js` file is indeed present in your project directory. If it's missing, you may need to add it or correct the path reference.

3. **Verify File Permissions**: Ensure that the file permissions allow it to be accessed by the web server. Check the file permissions and adjust them if necessary.

4. **Check Server Configuration**: If you're using a web server (e.g., Apache, Nginx), ensure that it is configured to serve the file correctly. Check the server configuration files and update them if needed.

5. **Debugging Tools**: Utilize browser developer tools to inspect network requests and verify if the file is being loaded and accessible. Look for any additional error messages or warnings that might provide more context.

6. **Browser Cache**: Clear your browser cache and reload the page to ensure that you're not loading a cached version of the page that might be missing the referenced file.

7. **Check File Extensions**: Verify that the file extension (`.js` in this case) matches the actual file type. Sometimes, incorrect file extensions can lead to file not found errors.

8. **File Naming**: Ensure that there are no typos or errors in the file name (`preloader.js`). Even a small typo can result in the file not being found.

By following these steps, you should be able to resolve the "Failed to load resource: net::ERR_FILE_NOT_FOUND" error and ensure that the referenced file is loaded successfully in your web application.

---


Comments:
Hi @IsaacZachary, thanks for opening an issue! 

Could you share the exact page i.e. its url that you're trying to access?

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.
[YOLOS] Remove deprecated arguments
Author: NielsRogge
Pull request: yes

# What does this PR do?

This PR removes the deprecated `max_size` and `pad_and_return_pixel_mask` arguments from `YolosImageProcessor`.

Users are now expected to use the format size={"shortest_edge": 800, "longest_edge": 1333} for instance.

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

Would be great to see this deprecated code removed! 

@NielsRogge I see that official DETR image processor configs are updated, but there are more configs with `max_size`
 - [Deformable DETR](https://huggingface.co/SenseTime) models
 - [Conditional DETR](https://huggingface.co/microsoft/conditional-detr-resnet-50/blob/main/preprocessor_config.json)
 - YOLOS: [base](https://huggingface.co/hustvl/yolos-base/blob/main/preprocessor_config.json) [small](https://huggingface.co/hustvl/yolos-small/blob/main/preprocessor_config.json) [small-dwr](https://huggingface.co/hustvl/yolos-small-dwr/blob/main/preprocessor_config.json)

And `pipelines` tests using some other models, like `hf-internal-testing/tiny-random-DetrForSegmentation`. It seems like their configs should be updated too.

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.
Use unused prepare_img() function in dinov2 conversion script
Author: IbrahimAmin1
Pull request: yes

# What does this PR do?

Use an unused function `prepare_img()` in `src/transformers/models/dinov2/convert_dinov2_to_hf.py` to load an image.

## 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?

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 and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @muellerzr and @SunMarc

Integrations:

- deepspeed: HF Trainer/Accelerate: @muellerzr
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc and @younesbelkada

Documentation: @stevhliu and @MKhalusova

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: @sanchit-gandhi
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


Comments:
Fix paligemma inverted mask
Author: molbap
Pull request: yes
Labels: name: run-slow

# What does this PR do?

This PR makes sure the causal mask created in paligemma merging is inverted. Else, inference will be broken by a `ValueError` check raised by `GemmaModel`.

In addition, a new test is added to make sure base fine-tuning setup is robust. 

Fixes #31171 


## Before submitting

- [x] 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 write any new necessary tests?



Comments:
cc @ArthurZucker for review :) 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_31207). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
transformers 4.41.2 breaks paligemma inference
Author: kishan-character
Pull request: no

### System Info

Custom 4D attention mask should be passed in inverted form with max==0`


```
inputs = processor(prompt, raw_image, return_tensors="pt").to(device)
output = model.generate(**inputs, max_new_tokens=100)
```

breaks on the newest version with error: `Custom 4D attention mask should be passed in inverted form with max==0``

If i use transformers==4.41.1 things work as expected

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

inputs = processor(prompt, raw_image, return_tensors="pt").to(device)
output = model.generate(**inputs, max_new_tokens=100)

### Expected behavior

model should generate an output

Comments:
inputs["attention_mask"] =  1 - inputs["attention_mask"]

I tried inverting the attention mask as above to get the max==0. But this results in weird results on decoding the output. The output is mostly a loop like "yesyesyes...."

True that  - the above approach returns the same thing to different inputs

same here....

Having same issue..

Python version: `3.10.14`
CUDA hardware: `GPU A100`
CUDA version: `12.0`
Torch version: `2.3.0`
Transformers version: `4.42.0.dev0`


Note: Having the same versions, but with a CUDA hardware `V100`, I don't have this issue

Thanks for the issue @kishan-character , taking a look now!

Hey @kishan-character, I can indeed reproduce on `main`. It's due to the merge of diff converter v2 which introduced this regression. https://github.com/huggingface/transformers/pull/30868/files#diff-4e745621c19ca6787145de230bf20402662c209f483c4f6d8d8940965aeefe7b .

I added the mask inversion in this update PR #31207 that should fix it!


You can solve it by downgrading the transformer version (transformers==4.41.1)

The diff converter was not part of the 4.41 nor 4.42 release. Is this affecting `4.42`?
convert_data2vec_audio_original_pytorch_checkpoint_to_pytorch.py works for data2vec 2.0 AttributeError: 'ModuleList' object has no attribute 'mlp' 
Author: Bogsamurai
Pull request: no
Labels: name: Audio

### System Info

transformers version: 4.41
Platform: Red Hat Enterprise Linux 8.4 (Ootpa)
Python version: 3.10.14 
PyTorch version  2.3+cu118 

### Who can help?

@sanchit-gandhi @SunMarc

### Information

- [X] 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

Run [convert_data2vec_audio_original_pytorch_checkpoint_to_pytorch.py](https://github.com/huggingface/transformers/blob/main/src/transformers/models/data2vec/convert_data2vec_audio_original_pytorch_checkpoint_to_pytorch.py)
AttributeError: 'ModuleList' object has no attribute 'mlp'

### Expected behavior

Expected behavior is that model weights must be loaded via this function: recursively_load_weights(model, hf_wav2vec, not is_finetuned)
but error is:
![image](https://github.com/huggingface/transformers/assets/143995447/f5dd9286-5ecd-4872-b19e-a3be1fae04fb)


Comments:
Closing as a duplicate of #31346
GGUF / Llama3: Fixes for loading llama3 models with GGUF
Author: younesbelkada
Pull request: yes

# What does this PR do?

Specifically addresses: https://github.com/huggingface/transformers/pull/30391#issuecomment-2145637564
Draft for now as the test is failing


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

Will open a new PR for it
Improve error msg when using bitsandbytes
Author: SunMarc
Pull request: yes

# What does this PR do ?

This PR fixes a typo in an error message and make it easier to debug when getting an import error for bitsandbytes. 

Fixes https://github.com/huggingface/transformers/issues/30751

Comments:
yes my bad i pushed the wrong branch. let me fix this ! 


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

Makes sense ! I think that this was the goal of `required_packages` attribute in `HfQuantizer` but we never used it in the end. I will do that in a follow up PR for all quants methods.
Seq TransfoRNA
Author: yak-hbdx
Pull request: no
Labels: name: New model

### Model description

The Seq TransfoRNA model is intended to map short RNA fragments (18 nt. to 30 nt.) back to their parental precursor. The model is trained in a supervised manner to classify ~2k subclasses belonging to 11 major classes.

### Open source status

- [X] The model implementation is available
- [X] The model weights are available

### Provide useful links for the implementation
https://github.com/gitHBDX/TransfoRNA/tree/master/transforna/src/model
@yak-hbdx @jje-hbdx @tos-hbdx

Comments:
cc @Rocketknight1 

Hi @yak-hbdx, if you or anyone else wants to try adding this model, you can follow the guide [here](https://huggingface.co/docs/transformers/en/custom_models) for uploading custom models to the Hub.
Fix Cohere CI
Author: ydshieh
Pull request: yes
Labels: name: run-slow

# What does this PR do?

Currently some tests are failing, see 

https://github.com/huggingface/transformers/actions/runs/9360271371/job/25765482477


This PR skips 2 of them and make 4 pass: 

```
FAILED tests/models/cohere/test_modeling_cohere.py::CohereModelTest::test_eager_matches_sdpa_generate - ValueError: Some modules are dispatched on the CPU or the disk. ..
FAILED tests/models/cohere/test_modeling_cohere.py::CohereIntegrationTest::test_batched_4bit - torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 88.00 MiB. GPU
FAILED tests/models/cohere/test_modeling_cohere.py::CohereIntegrationTest::test_batched_small_model_logits - RuntimeError: Half did not match Float
FAILED tests/models/cohere/test_tokenization_cohere.py::CohereTokenizationTest::test_torch_encode_plus_sent_to_model - RuntimeError: scaled_dot_product_attention_flash_attention does not support FP16 on the platforms without amx_fp16 support
```

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_31263). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
special token `
` conflicts with html tag `
`
Author: scruel
Pull request: no

### System Info

- `transformers` version: 4.41.2
- Platform: Linux-6.5.0-14-generic-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.23.3
- Safetensors version: 0.4.3
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.3.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 GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

@ArthurZucker

### 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 transformers import AutoTokenizer
>> tokenizer = AutoTokenizer.from_pretrained(
>>     "meta-llama/Llama-2-7b-hf", local_files_only=True, encode_special_tokens =False)
>> text = "
Yay!
"
>> x = tokenizer.encode(text, add_special_tokens=False)
>> x
[1, 612, 388, 29991, 2]
>> text2 = tokenizer.decode(x)
>> assert text == text2
False
>> text2
'
 Yay!
'
```

### Expected behavior

text == text2

Comments:
Hey! Not sure what went wrong, but if you set `encode_special_tokens` on main, the encoding of `
` and `
` are going to be the ones the model can reach with BPE, and thus in this case, `'<', 's', '>'`

I noticed that it has already been considered in recently commits, and I applied a workaround which solved related issues. This issue will not be a problem anymore, after you make a new release which contains them, thanks for your answer!
Adding variant as a keyword to config.save_pretrained
Author: sachinruk
Pull request: yes

# What does this PR do?

When saving a model of type `PreTrainedModel` via `save_pretrained` you can add a variant argument so that the final model name can be `model.vision.safetensors` or `model.text.safetensors`. However, this capability is not extended to configuration files. This is a PR to add this capability

Fixes # (issue)
If in a file you do the following, you only get one configuration file with the last config
```python
vision_model.save_pretrained(save_directory, variant="vision")
text_model.save_pretrained(save_directory, variant="text")
```

**Note: Tests are failing.** Will fix those issues if this PR is useful in the first place. Please let me know if this PR will be accepted if I fix the rest of the tests.

## 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?
- [x] 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?

cc @fxmarty

Comments:
Hey @sachinruk, can you walk me through what use case that would enable?

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.
[WIP] Remove the need to contribute to inits when contributing a model
Author: LysandreJik
Pull request: yes


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

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.
Unable to load t5-small tokenizer saved with latest packages in older versions
Author: jpmann
Pull request: no

### System Info

| Step No | Transformer | Tokenizers| Sentence Piece|
|--------|--------|--------|------|
| 1| 4.40.0| 0.19.1|0.1.99|
| 2| 4.34.1| 0.14.1| 0.1.99|

### Who can help?

@ArthurZucker @you

### Information

- [ ] The official example scripts
- [X] 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

> Step 1: Save the t5-small tokenizer with latest packages
```
import transformers
print(transformers.__version__)  # 4.40.0

import tokenizers
print(tokenizers.__version__)  # 0.19.1

import sentencepiece
print(sentencepiece.__version__) # 0.1.99

from transformers import AutoTokenizer
t5_tok = AutoTokenizer.from_pretrained("t5-small")
print(t5_tok)
t5_tok.save_pretrained("t5_small_xr_4_40_0")
```

> Step2: Load the tokenizer saved in step#1 in older packages
```
import transformers
print(transformers.__version__)  # 4.34.1

import tokenizers
print(tokenizers.__version__)  # 0.14.1

import sentencepiece
print(sentencepiece.__version__) # 0.1.99

from transformers import AutoTokenizer
t5_tok = AutoTokenizer.from_pretrained("t5_small_xr_4_40_0")
print(t5_tok)
```

### Expected behavior

The step#2 is failing with error
![image](https://github.com/huggingface/transformers/assets/12165281/618b21bb-9461-4b2e-a001-aacb5a6fbdb2)

I see that the `tokenizer.json` looks different when saved with environment setup in step#1 and step#2 (see system info section for environment details)
![image](https://github.com/huggingface/transformers/assets/12165281/c6c2b5af-d270-49d1-a165-185a6acaaeb3)

When I looked further into it, I see that `add_prefix_space` which is present in older packages is no longer present. And 2 new fields got introduced `prepend_scheme` and `split`. I believe the change in contract caused the failure.

> Couple of questions in this context
1. The newer changes to tokenizer + transformer packages are expected to be backward compatible?
2. Will there be any tokenization differences when
I save the tokenizer with env in step#1 and tokenize a dataset
I save the tokenizer with env in step#2 and tokenize a dataset

I will launch tests on question#2 and share the output here, but in case the answer is already known, please let me know.

Comments:
Hey! What you are asking for is `Forward Compatibility` not `Backward Compatibility`. 
The issue lies with the `tokenizers` version, not `transformers`.  And as such this is expected. You can probably hack to use tokenizers 0.19 but an older version of transformers. 

To answer you questions:
- there are going to be speed differences 
- there are going to be differences with added tokens if there are any. See #28881 for more details.

Thanks @ArthurZucker. this helps.
Fix gradio tool demos
Author: aymeric-roucher
Pull request: yes
Labels: name: Agents

# What does this PR do?

Resolves Gradio demos on Spaces for tools not working properly.

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

# What does this PR do?

AutoBackbone was not included in the French version of [`autoclass_tutorial.md`], so this update adds the missing translation.

Comments:
cc @ArthurZucker as my French is dodgy at best 🇫🇷 

@ArthurZucker - is it possible to double check and confirm the french translation?
thx :)

@younesbelkada @NielsRogge
Could you approve the small missing translation to french? :)

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