noamaanMulla-03/transformers-issues huggingface dataset:
Remove roberta dependency from longformer fast tokenizer
Author: sirmammingtonham
Pull request: yes

# What does this PR do?
This PR removes the RoBERTA fast tokenizer dependency from the Longformer fast tokenizer, as tasked in #19303.

## 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#start-contributing-pull-requests),
      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).
- [ ] 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.

@sgugger 
<!-- 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:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


Comments:
_The documentation is not available anymore as the PR was closed or merged._

Thanks again for your contribution!
Remove bert fast dependency from electra
Author: Threepointone4
Pull request: yes

# What does this PR do?

-  Related to #19303 
-  Removed `Bert` fast dependency from `Electra` code base.


<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->


## 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#start-contributing-pull-requests),
      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).
- [ ] Did you write any new necessary tests?


## Who can review?
@sgugger 



Comments:
_The documentation is not available anymore as the PR was closed or merged._
Make `MobileBert` tokenizers independent from `Bert`
Author: 501Good
Pull request: yes

# What does this PR do?

Copied the code from `Bert` tokenizers into `MobileBert` tokenizers to make the latter self-contained.

Fixes #19303 


## 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#start-contributing-pull-requests),
      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).
- [ ] Did you write any new necessary tests?


## Who can review?

@sgugger


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_19417). All of your documentation changes will be reflected on that endpoint.

Hi @501Good, as you can see, your rebase has messed the diff on Git a little. Could you open a fresh PR from your branch?

Hi @sgugger, sorry for that! Opened a new PR here #19531!
follow layoutlmv3 to avoid device error
Author: allanj
Pull request: yes

# What does this PR do?

Slightly modify the way that we calculate the height and width embeddings for LayoutLMv2. The calculation is simply same as LayoutLMv3 to avoid the device-assert error when we run experiments on GPU. 

https://github.com/huggingface/transformers/blob/main/src/transformers/models/layoutlmv3/modeling_layoutlmv3.py#L270-L271

Fixes # (issue)




## Who can review?



Models:
 - LayoutLMv2: @patrickvonplaten @NielsRogge 




Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_18829). All of your documentation changes will be reflected on that endpoint.

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.
AssertionError: Padding_idx must be within num_embeddings  MarianModel
Author: talhaanwarch
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.22.2
- Platform: Linux-5.10.133+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.14
- Huggingface_hub version: 0.10.0
- PyTorch version (GPU?): 1.12.1+cu113 (False)
- Tensorflow version (GPU?): 2.8.2 (False)
- 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?

### Who can help?

@LysandreJik

### Information

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

The code is taken from official huggingface documentation [here](https://huggingface.co/docs/transformers/model_doc/marian#transformers.MarianConfig.example)

from transformers import MarianModel, MarianConfig

#### Initializing a Marian Helsinki-NLP/opus-mt-en-de style configuration
configuration = MarianConfig()

#### Initializing a model from the Helsinki-NLP/opus-mt-en-de style configuration
model = MarianModel(configuration)

#### Accessing the model configuration
configuration = model.config

### Expected behavior

I am trying to initialize MarianModel without using pretrained weights. So instead of this code
```
model_name = "penpen/novel-zh-en"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
```` 
I wan to use it with out using pretrained model. Instead I want it to be trained from scratch.  So i used MarianConfig, but it throw the error. 
```
AssertionError: Padding_idx must be within num_embeddings
```


Comments:
Hi @talhaanwarch 👋 This seems to be an error in our default value for the size of the embeddings. Thank you for raising it!

Meanwhile, you should be able to run
```python
from transformers import MarianModel, MarianConfig

# Initializing a Marian Helsinki-NLP/opus-mt-en-de style configuration
configuration = MarianConfig()
configuration.vocab_size = configuration.pad_token_id + 1

# Initializing a model from the Helsinki-NLP/opus-mt-en-de style configuration
model = MarianModel(configuration)
```
Update Marian config default vocabulary size
Author: gante
Pull request: yes

# What does this PR do?

Fixes #19296 

Looking at existing Marian models, their vocabulary size is set to pad token id + 1 ([example](https://huggingface.co/Helsinki-NLP/opus-mt-de-en/blob/main/config.json#L59)). This PR modifies the default vocabulary size such that a) it doesn't throw exceptions (must be > pad token id) and b) preserves this property.

Alternatively, the default for `decoder_start_token_id` and `pad_token_id` can be reduced 🙃 

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Looks like a bugfix to me if the model cannot be instantiated. Looks good to me.
Make `MobileBert` tokenizers independent from `Bert`
Author: 501Good
Pull request: yes

# What does this PR do?

Copied the code from `Bert` tokenizers into `MobileBert` tokenizers to make the latter self-contained.

Fixes #19303 


## 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#start-contributing-pull-requests),
      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).
- [ ] Did you write any new necessary tests?


## Who can review?

@sgugger


Comments:
XLMRobertaTokenizerFast  Error
Author: elmadany
Pull request: no

### System Info

I've created a new vocab using sentencePiece PBE, I trained an xlm-roberta-base from scratch using [run_mlm.py](https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_mlm.py). When I tried loading the tokenizer using AutoTokanizer or XLMRobertaTokenizerFast it takes a long time and doesn't load, while I load it using XLMRobertaTokenizer is works well. 
I noticed this problem when I tried to finetune the model on ner using the official ner script [run_ner.py](https://github.com/huggingface/transformers/blob/main/examples/pytorch/token-classification/run_ner.py) which works only on fast tokanizer. 
I was wondering how to convert it to a fast tokenizer.

### Who can help?

@SaulLu @sgu

### Information

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

I built the vocab using this command
spm_train --input="merged_vocab_data.txt" --model_prefix=sentencepiece.bpe --vocab_size=250002 --character_coverage=0.9995 --model_type=bpe --pad_id=0 --eos_id=1 --unk_id=2 --bos_id=-1

I used this vocab to initial the training model  using the official code run_mlm.py

### Expected behavior

How to convert the sentencepiece BPE slow vocab to fast

Comments:
@SaulLu

Maybe of interest to @ArthurZucker as well!

Hi @elmadany

The conversion of a vocabulary coming from sentencepiece to a fast version of the tokenizer is indeed an operation which can take time, but it is an operation to be carried out only once because once loaded you can save the converted version with the fast format not to have to remake this operation the next time.

On the other hand, I am a little more concerned when you say that it "doesn't load", do you have an error message? 

Thanks @SaulLu
yes, it took 4 hours to convert.
So, I will close this issue
Remove `MarkupLMForMaskedLM` from `MAPPING`
Author: ydshieh
Pull request: yes

# What does this PR do?

There is no `MarkupLMForMaskedLM`.

BTW, could we check if the arguments passed to the recursive call are identical to the inputs: if so, don't call recursively.
https://github.com/huggingface/transformers/blob/4edb3e49f6bd3d1a4f6862452ecaf07108d62ff7/src/transformers/models/auto/auto_factory.py#L548-L558

I  can work on that if you are OK, @sgugger .

I freak out when I see
```bash
RecursionError: maximum recursion depth exceeded while calling a Python object
```

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Add a decorator for flaky tests
Author: sgugger
Pull request: yes

# What does this PR do?

This PR adds a new decorator to mark flaky tests, which will then automatically re-run them up to five times each time they fail (that param can be adapted). I've marked as flaky three tests I have seen recently fail for no reason as a demo.

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Albert config update
Author: imarekkus
Pull request: yes

Hey!

# What does this PR do?
Updates Albert config following the below issue (note that the first step is already done, thus no change was made)
![image](https://user-images.githubusercontent.com/49692939/195411298-fbeffddc-12b5-46f3-9675-7397dd787711.png)


Tests passed
![image](https://user-images.githubusercontent.com/49692939/195411199-72c56092-8801-4722-aae7-c78b7b957fc2.png)



Comments:
_The documentation is not available anymore as the PR was closed or merged._
[Doctest] `Add configuration_whisper.py`
Author: daspartho
Pull request: yes

Add `configuration_whisper.py` to `utils/documentation_tests.txt` for doctest.

Based on issue https://github.com/huggingface/transformers/issues/19487

@sgugger could you please check it?
Thanks :)

Comments:
@daspartho There is an extra empty line which fails the tests. Could you remove it? Thanks.

In fact, you can use `make style` to see the necessary change(s).

@ydshieh removed it, should work nicely now :)

_The documentation is not available anymore as the PR was closed or merged._
Throw an error if `getattribute_from_module` can't find anything
Author: ydshieh
Pull request: yes

# What does this PR do?

Throw an error if `getattribute_from_module` can't find anything - to avoid `RecursionError: maximum recursion depth exceeded while calling a Python object`.


**New error:**

```bash
ValueError: Could not find MarkupLMForMaskedLM neither <module 'transformers.models.markuplm' from '/home/yih_dar_huggingface_co/transformers-ydshieh/src/transformers/models/markuplm/__init__.py'> in nor in <module 'transformers' from 'src/transformers/__init__.py'>!
```

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Create the arange tensor on device for enabling CUDA-Graph for Clip Encoder
Author: RezaYazdaniAminabadi
Pull request: yes



# What does this PR do?
This PR changes the allocation of a tensor at the [modeling_clip.py](https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L665) to happen at device side, to be able to use CUDA-Graph at DeepSpeed-Inference, which can help improve the performance for the Stable-Diffusion model inference. Here is the [PR ](https://github.com/microsoft/DeepSpeed/pull/2381)that includes the optimization for improving the SD performance.

## 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?

@patrickvonplaten, @stas00 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Build Push CI images also in a daily basis
Author: ydshieh
Pull request: yes

# What does this PR do?

PR #19170 separated the images for push CI and daily CI. However, it only build the push CI images (that with the postfix `-push-ci`) when changes in `setup.py` are detected.

**We should also re-build the push CI images in a daily basis**, as 3rd party libraries might have newer versions, like `datasets`, `tokenizers` etc.

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Generate does not take into account config.decoder.eos_token_id
Author: NielsRogge
Pull request: no
Labels: name: Good First Issue

As reported by some people (see https://github.com/NielsRogge/Transformers-Tutorials/issues/53 and on the [forum](https://discuss.huggingface.co/t/trocr-repeated-generation/12361)), the `generate()` method currently does not take into account `config.decoder.eos_token_id`, only` config.eos_token_id` to properly stop generation.

Hence, models that are made using `EncoderDecoderModel`/`VisionEncoderDecoderModel`/`SpeechEncoderDecoderModel` will not properly stop generation if `config.eos_token_id` is not set.

cc @patrickvonplaten @patil-suraj 

Comments:
Hmm, yeah I think I'm fine with adding some `if - statements` to the `generate()` method

Do you want to open a PR for it? :-)

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/master/CONTRIBUTING.md) are likely to be ignored.

i will try to fix it

I pulled a request https://github.com/huggingface/transformers/pull/15403, but the ci failed. By analysing the ci failture log, I find that it has a hidden logic, if you don't pass a eos_pos_id, you want the model to generate until max-length. That is what the code do
https://github.com/huggingface/transformers/blob/16d4acbfdb547cb922361ba07a13de12e1503fb8/tests/test_modeling_encoder_decoder.py#L404
So, adding self.config.decoder.eos_pos_id simply is not enough. 
cc @NielsRogge @patrickvonplaten 

Hi, the above pull request mentioned offhandedly that this had been fixed, is that the case or is this still open as indicated?

Seems like this got fixed, closing the issue.
[Doctest] Add configuration_big_bird.py
Author: imarekkus
Pull request: yes

Hi!

Updating configuration_big_bird.py

Based on issue https://github.com/huggingface/transformers/issues/19487

Tests passed
![image](https://user-images.githubusercontent.com/49692939/195433142-d6c12962-1d36-4868-a754-e20766230233.png)


Comments:
_The documentation is not available anymore as the PR was closed or merged._

Hey, there seems to be a problem with this line
![image](https://user-images.githubusercontent.com/49692939/195444333-07c19198-5011-4423-9578-fa85ec7ce294.png)

Check_code_quality is returning this error:
![image](https://user-images.githubusercontent.com/49692939/195444639-3244e864-ebc6-4bc2-987a-980db6667ac1.png)

When I tried to keep it below 119 in length and move some of the text to the next line I got another error
![image](https://user-images.githubusercontent.com/49692939/195445536-98f17a58-484b-4608-8d04-c82ab72f06d6.png)

Thus I can not add this 'with random weights' text and I am wondering how to solve this problem.
Update Whisper docs clarifying inference support for long-form decoding
Author: akashmjn
Pull request: yes


@ArthurZucker @patrickvonplaten 
I have updated the [Whisper docs page](https://huggingface.co/docs/transformers/v4.23.1/en/model_doc/whisper#transformers.WhisperProcessor) to clarify that the current `decode()` implementation doesn't support long-form yet. Hope it'll save folks some time, vs digging in to find that out :) 


Comments:
_The documentation is not available anymore as the PR was closed or merged._

Thanks for the addition 😉
[Doctest] - Fixing doctest bert_generation configuration
Author: Threepointone4
Pull request: yes

# What does this PR do?
Fixing doctest in bert_generation configuration. Issue : #19487

## Fixes # (issue)
Added (`with random weights)` in `modeling_ber_generation.py`.
Added `modeling_ber_generation.py` in `documentation_tests.txt`

## Who can review?
@ydshieh @sgugger 




Comments:
_The documentation is not available anymore as the PR was closed or merged._
[Doctest] Add configuration_canine.py
Author: IzicTemi
Pull request: yes

Add configuration_canine.py to utils/documentation_tests.txt for doctest.

Based on issue [#19487](https://github.com/huggingface/transformers/issues/19487)

@ydshieh could you take a look at it?
Thanks :)

Comments:
_The documentation is not available anymore as the PR was closed or merged._
[WIP] Add type hints for Lxmert (TF)
Author: elusenji
Pull request: yes

# What does this PR do?

This PR adds type hints to the Lxmert model for TensorFlow.

Models:

Lxmert: @LysandreJik


Comments:
_The documentation is not available anymore as the PR was closed or merged._

@Rocketknight1 Is there anything else I need to add to this PR?

@elusenji No, sorry! I meant to merge it after the tests passed but lost track of it yesterday. Doing it now, and thanks again!