noamaanMulla-03/transformers-issues huggingface dataset:
Add DINO conversion script
Author: NielsRogge
Pull request: yes

# What does this PR do?

I've uploaded the Vision Transformers trained using the self-supervised method called [DINO](https://github.com/facebookresearch/dino) to the hub: https://huggingface.co/models?other=dino

This PR includes the conversion script that was used.

I've also added a reference to DeiT, BEiT and the DINO checkpoints to the docs of ViT, to give these models some more love.



Comments:
Moving `text-generation` pipeline to new testing framework.
Author: Narsil
Pull request: yes

# What does this PR do?

<!--
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.
-->

<!-- Remove if not applicable -->

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/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:

- 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:
Add SENet Blocks in Encoding Layers
Author: calusbr
Pull request: no
Labels: name: Feature request

# 🚀 Feature Request

I read the article "[SesameBERT: Attention for Anywhere](https://arxiv.org/pdf/1910.03176.pdf)" and would like to add SENet blocks in the Huggingface implementation. The article's authors made an implementation with [Tensorflow](https://github.com/ICLR2020Sesame/SesameBert/blob/master/modeling.py), but I would like to use the lib in pytorch.

## Motivation

The use of ([Squeeze-and-Excitation Networks](https://arxiv.org/abs/1709.01507)) SENet Blocks has obtained state-of-the-art results. And they seem to be promising in NLP.

## Your contribution

I know that it is possible to modify the [[BertLayer()](https://github.com/huggingface/transformers/blob/61c506349134db0a0a2fd6fb2eff8e29a2f84e79/src/transformers/models/bert/modeling_bert.py#L430)] and [[BertEnconder()](https://github.com/huggingface/transformers/blob/61c506349134db0a0a2fd6fb2eff8e29a2f84e79/src/transformers/models/bert/modeling_bert.py#L513)] classes

Any suggestions on how to modify the code so that you can apply the idea used in the article?

![image](https://user-images.githubusercontent.com/25322394/120578580-0f3ca000-c3f4-11eb-9a14-93bf610c3a60.png)


Comments:
Hey, I'd like to work on implementing this feature if it hasn't been done yet.
Moving `token-classification` pipeline to new testing.
Author: Narsil
Pull request: yes

# What does this PR do?

<!--
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.
-->

<!-- Remove if not applicable -->

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/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:

- 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:
examples: add keep_linebreaks option to CLM examples
Author: stefan-it
Pull request: yes

Hi,

as discussed in #12971 a newline is missing when using the CLM example scripts, when no dataset name is provided (this is the case when you use "normal" text files).

This PR adds the `keep_linebreaks=True` option to all CLM example scripts (when using files).

Comments:
Thanks a lot for your PR @stefan-it! 

Could we maybe make `keep_linebreaks` configurable by the command line and let it default to `True`? So ideally we could add it to the `DataArguments` class

@patrickvonplaten good idea, I'm working on it now!

I've implemented it :) 

The `examples/pytorch/language-modeling/run_clm_no_trainer.py` uses the raw argument parser, so I used the same boolean logic as used for the fast tokenizer (or here: slow tokenizer).

Thanks a lot for your PR @stefan-it! 

@sgugger agreed to make this change here: https://github.com/huggingface/transformers/issues/12971 

So good to merge for me!
Add support for XLM-R XL and XXL models
Author: stefan-it
Pull request: yes

Hi,

this PR adds support for the recently released XL and XXL models for XLM-R. These models are described in the ["Larger-Scale Transformers for Multilingual Masked Language Modeling"](https://arxiv.org/abs/2105.00572) paper.

It turns out, that these new models are trained with a more recent version of `fairseq` compared to the "old" XLM-R Base and Large models. Only the current `master` version of `fairseq` is able to load these new models correctly. Unfortunately, some model changes were made (see [this](https://github.com/pytorch/fairseq/commit/54423d3b22a3e7f536e02e9e5445cef9becbd60d) refactoring commit), and the following changes needs also to be done in Transformers library:

The XLM-R Base and Large model used layer normalization in the embeddings, whereas the newer XL and XXL models do not make use of normalized embeddings: layer normalization is done at the end of the transformer. See discussion here: https://github.com/pytorch/fairseq/issues/3600

@patrickvonplaten proposed to introduce a new `RobertaConfig` variable - like `normalize_embeddings` - in order to reflect these model changes in `modeling_roberta.py` directly, instead of writing a new model class (which copies 99% of existing code).

----

Changes made so far:

* [x] Update conversion script to work with lastest `fairseq` master version (*1.0.0a*)

Necessary changes:

* [ ] Introduce new config variable in `RobertaConfig` to indicate different layer normalization "strategies"
* [ ] Implement these different layer normalization settings in all modeling classes
* [ ] Re-run conversion script and upload converted XLM-R XL and XXL models to hub

Comments:
@Soonhwan-Kwon conversion script is currently not working yet for the newer models, but it is working for XLM-R Base for example. Layer norm changes need to be done first in RoBERTa modeling code, so that conversion script is writing a correct model :)

Hi  @stefan-it thanks for contributing the new models and do you have any plan to push the code and models into https://huggingface.co/models recently @patrickvonplaten ? 

Waiting for this model. Is there any expected timeline? @patrickvonplaten 

Should we try to look into it again @stefan-it ? :-)
"Write with Transformer" source code?
Author: AIsysxd
Pull request: no
Labels: name: Write With Transformer

## ❓ Questions & Help
Hello, can't find source code of it. May you help, please?
<!-- A clear and concise description of the question. -->


Comments:
Hello,

Sorry, the web app is not open source right now.

Thanks @julien-c .  Can you comment on how elastic inference with pytorch models is done?

Is there any chance this could be reconsidered? I'd love to use it for experimenting with custom fine-tuned models.

Would also love for this for experimenting with custom models.


It'd be very interesting to open source this.

Is there any intention of doing so in the future?

Is there any possibility of this becoming reconsidered? I've been trying to look for this as well... :/

Any chance of this being public? @thomwolf 

> Would also love for this for experimenting with custom models.

Same!

the microsoft/fastformers repo says "Write With Transformer, built by the Hugging Face team at transformer.huggingface.co, is the official demo of this repo’s text generation capabilities" according to this [readme](https://github.com/microsoft/fastformers/blob/main/README_transformers.md#online-demo). Last commit October 2020
BeitForMaskedImageModeling forward not using bool_masked_pos
Author: elliottzheng
Pull request: no



### Who can help
@NielsRogge

## Information

I am reading the code of BEIT, trying to use the `BeitForMaskedImageModeling`, while I found the `bool_masked_pos` is defined but not used in `BeitForMaskedImageModeling`'s forward.

In my understanding, `bool_masked_pos` is used to mask out the input image tokens, thus should be passed to the `self.beit` forward here.
https://github.com/huggingface/transformers/blob/5c6eca71a983bae2589eed01e5c04fcf88ba5690/src/transformers/models/beit/modeling_beit.py#L723

Furthermore, the documentation of the `BeitForMaskedImageModeling`'s `forward` lack the description of the `bool_masked_pos`.




Comments:
Hi,

Thanks for looking into this model. Looking at it now, it's indeed a mistake, not sure why I forgot to pass `bool_masked_pos` to `BeitModel`.

I have a Colab notebook, in which I tried to reconstruct DALL-E's visual tokens using `BeitForMaskedImageModeling`: https://colab.research.google.com/drive/1Mjt-3jHw9HYMXECmSdDlbiG59ZAw-Z0T?usp=sharing#scrollTo=ZwTO9fbhPOxi

It was not working as expected, so probably that'll be the mistake.

> Furthermore, the documentation of the BeitForMaskedImageModeling's forward lack the description of the bool_masked_pos.

This is a good point and should be added. 

I will fix both in a PR.

Thanks!
Conversion of Wav2vec2 model to TFWav2vec2 model
Author: harveenchadha
Pull request: no

Hi,

I trained model using fairseq toolkit.

I have successfully converted the model from fairseq to huggingface .bin model.

How can I convert to pure pytorch (.pt) and tensorflow (.h5) format.

Are there any scripts for that?

Comments:
Hey @harveenchadha, to convert from PT to TF, you can just do:

```python
from transformers import TFWav2Vec2Model

model = TFWav2Vec2Model.from_pretrained("<path/to/hf.bin model folder>", from_pt=True)
model.save_pretrained("<path/to/save/.h5>")
```

Also note that (`.pt`) and (`.bin`) is the same format in most cases as far as I understand: https://stackoverflow.com/questions/57245332/what-are-the-difference-between-bin-and-pt-pytorch-saved-model-types#:~:text=1%20Answer&text=There%20is%20no%20difference%20as,torch%20can%20read%20either%20.
I can not find transformers v4.9.0
Author: junleiz
Pull request: no

![image](https://user-images.githubusercontent.com/26025961/126280808-c693ba49-0e47-43ac-9299-441baca98714.png)
The doc said the transformer v4.9.0 introduces a new package: transformers.onnx. However I can not find transformers v4.9.0.

Comments:
v4.9.0 will be out in a few days - for now you can install from source:
```
pip install git+https://github/huggingface/transformers
```

@LysandreJik  Thank you for your repley. I installed the master branch. And tried the BART-large and MBart model (the architecture is totally the same). For Bart-large, I got the following warings:

![image](https://user-images.githubusercontent.com/26025961/126290768-0e8d4998-8b24-470a-b74c-7401b00c1c19.png)
which may have some influences on the performance.

For the Mbart, I got the following error:
![image](https://user-images.githubusercontent.com/26025961/126290880-825b053a-21f7-40d6-b9de-949bfce16aeb.png)
Their archs are the same, so I think the Mbart should work as well. But it seems that it loses some propoerties


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.
[Documentation] Improve docs for hyper-parameter search
Author: LoganWalls
Pull request: no

# 🚀 Improve documentation for hyper-parameter search

## Motivation

I was recently trying to implement a custom logging callback to use with `Trainer.hyperparameter_search(...)`, but I could not figure out how to access the current run's hyper-parameters to log them. After digging into the source code I discovered that they are available as `TrainerState.trial_params`, which is [currently undocumented](https://huggingface.co/transformers/master/main_classes/callback.html#trainerstate). To make it easier for future users I think the `trial_name` and `trial_params` properties of `TrainerState` should be documented.

## Your contribution

If the maintainers agree that these properties should be documented I'm happy to edit the docstring and submit a PR. Please let me know.

@sgugger 


Comments:
Yes, please go ahead with a PR, thank you!

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.
Fixing mbart50 with `return_tensors` argument too.
Author: Narsil
Pull request: yes

# What does this PR do?

<!--
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.
-->

<!-- Remove if not applicable -->

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/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:

- 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:
examples: only use keep_linebreaks when reading TXT files
Author: stefan-it
Pull request: yes

Hi,

this is a follow-up (bug-fix) PR for #13150.

It turns out - as reported in #13312 - that the `keep_linebreaks` argument only works, when Datasets extension is `text`.

I used this logic to only pass the `keep_linebreaks` argument, when extension is `text`, simplified as:

```
dataset_args = {}

if extension == "text":
    dataset_args["keep_linebreaks"] = True

dataset = load_dataset(extension, data_files=data_files, **dataset_args)

print(dataset["train"][0])
```

When `keep_linebreaks` was set to `True` and reading in a text file, the output looks like:

```bash
{'text': 'Heute ist ein schöner Tach\n'}
```

For `keep_linebreaks` set to `False` the output looks like:

```bash
{'text': 'Heute ist ein schöner Tach'}
```

So the proposed way is working with the `dataset_args` argument. I also checked all examples that they're working when passing a CSV dataset.


Comments: