noamaanMulla-03/transformers-issues huggingface dataset:
Fix link to Evaluate TAPAS Notebook
Author: mrm8488
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 which 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.

 albert, bert, XLM: @LysandreJik
 GPT2: @LysandreJik, @patrickvonplaten
 tokenizers: @mfuntowicz
 Trainer: @sgugger
 Benchmarks: @patrickvonplaten
 Model Cards: @julien-c
 examples/distillation: @VictorSanh
 nlp datasets: [different repo](https://github.com/huggingface/nlp)
 rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
 Text Generation: @patrickvonplaten, @TevenLeScao
 Blenderbot, Bart, Marian, Pegasus: @patrickvonplaten
 T5: @patrickvonplaten
 Rag: @patrickvonplaten, @lhoestq
 EncoderDecoder: @patrickvonplaten
 Longformer, Reformer: @patrickvonplaten
 TransfoXL, XLNet: @TevenLeScao, @patrickvonplaten
 examples/seq2seq: @patil-suraj
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 FSMT: @stas00
 -->


Comments:
Fix link to Notebook to fine-tune TAPAS
Author: mrm8488
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 which 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.

 albert, bert, XLM: @LysandreJik
 GPT2: @LysandreJik, @patrickvonplaten
 tokenizers: @mfuntowicz
 Trainer: @sgugger
 Benchmarks: @patrickvonplaten
 Model Cards: @julien-c
 examples/distillation: @VictorSanh
 nlp datasets: [different repo](https://github.com/huggingface/nlp)
 rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
 Text Generation: @patrickvonplaten, @TevenLeScao
 Blenderbot, Bart, Marian, Pegasus: @patrickvonplaten
 T5: @patrickvonplaten
 Rag: @patrickvonplaten, @lhoestq
 EncoderDecoder: @patrickvonplaten
 Longformer, Reformer: @patrickvonplaten
 TransfoXL, XLNet: @TevenLeScao, @patrickvonplaten
 examples/seq2seq: @patil-suraj
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 FSMT: @stas00
 -->


Comments:
[test_model_parallelization] multiple fixes
Author: stas00
Pull request: yes
Labels: name: Model Parallel

There are multiple issues with the current common `test_model_parallelization` test.

The main issue is that it uses `nvidia-smi` to take memory snapshots. This leads to 2 potential problems:
1. these tests must not be run with pytest distributed, as they rely on all the GPUs being unused - and with `-n 2` or higher it's likely to break, since `nvidia-smi` would be indiscriminately reporting memory used by other pytest workers.

    I fixed this problem first by creating a new `@require_no_pytest_distributed` decorator at  https://gist.github.com/stas00/5d58c606dbdcb82e019d6b0674f8b42a - but once the 2nd problem was fixed it no longer was needed so I removed it. I don't think we currently have any tests that must be run without `pytest-xdist`, but if any come in the future we can merge that skip decorator too.
    
2. this implementation can easily return incorrect info if CUDA device order doesn't match nvidia-smi device order (my case and this test fails for me) - so one has to use `CUDA_VISIBLE_DEVICES` to match CUDA device order to nvidia-smi's for this test to pass.

Switching to `torch.cuda.memory_allocated` fixes both problems as it measures memory usage for the current process only and in the correct order - i.e. `to(0)` always matches `memory_allocated(0)` device-wise. (the weird multi-line implementation has to do with https://github.com/pytorch/pytorch/issues/49952)

BTW, I first thought of using `pynvml`, but it would have had the same issue.` nvidia-smi` is just another front-end to `nvml`.

Other fixes:

* removes hardcoded gpt2 config
* adds `gc.collect`. One can't rely on exact memory measurements w/o manual `gc.collect` - since it gets triggered automatically at certain times as explained in its docs, which is often too late for what's being measured. Most of the time when you `del foo` it doesn't get reclaimed by `gc` right away. So the correct sequence when exact memory measurements are desired is:
   ```
            del some_variable
            gc.collect()
            torch.cuda.empty_cache()
            # now can measure memory
   ```
* last sub-test adjusted to measure against the memory snapshot before that sub-test and not at the beginning of the whole test.

`get_current_gpu_memory_use` might go into testing or benchmarking utils and perhaps need to change its name to match that it returns MBs, but it's good enough for now.

@alexorona, please let me know if it's of interest to you for the tweaks I've been proposing - please let me know if you'd like me to tag you on these.

@patrickvonplaten, @LysandreJik 

Comments:
Thank you for fixing!
Transformer models for semantic parsing
Author: ayushjain1144
Pull request: no

Hi! Thank you for your awesome work!

I want to perform semantic parsing. Unfortunately, I couldn't find any examples on hugging face repo for that. Could you please let me know how I should proceed? I suppose I could use a Seq2Seq EncoderDecoder model like BERT2BERT and finetune it for semantic parsing. Or do you think there is a better way? For more context, I have natural language grounding descriptions and  I want to generate logical parse tree from it. In literature, there are a few tree transformer-based techniques and Seq2Tree technique which I think hugging face do not support yet (or does it?). 

Thanks :)

Comments:
Hi @ayushjain1144 

That's an interesting question, would be better if you ask it on the [forum](https://discuss.huggingface.co/)
Allow example to use a revision and work with private models
Author: sgugger
Pull request: yes

# What does this PR do?

This PR adds the ability to:
- pick a particular revision for a model checkpoint
- use private models when the user is logged in
with the example scripts.

Just did `run_glue` as a proof of concept, will duplicate to all examples and the new example template if this suits everyone.


Comments:
+1 on the `model_revision` part

On the `use_auth_token`, I was thinking we could try to implement auto-use of the token _iff_ the model is not public (i.e. send the token for non-existent models and private models, as the server doesn't make a difference for those two cases when unauthorized – you get a 404 in both cases – said differently if you don't have access to a model you shouldn't know whether it's an existing private model)

This will require some implementation changes in file_utils though so it might take a bit of time. 

If you think it's helpful to expose this PR's manual option first, I'm ok with that.

@LysandreJik Yep totally right! I won't personally get around to adding the feature in file_utils/huggingface_hub in the next 2-3 weeks though, so maybe worth it to merge it like this in the meantime:)

I think it's important to provide the option right now to let the user play with their private models for those scripts. We can have that flag become `None` later on and default to the right thing when the implementation in `file_utils` permits it then remove it entirely a bit later.

sounds good

Sounds good!
[autoformatters] wrapping destroying items/lists
Author: stas00
Pull request: no

# 🚀 Feature request

Would it be possible to make the auto-wrappers respect items/lists?

e.g. ended up with:
```
        """
        number of training steps is either 1. args.max_steps if --max_steps > 1 2. else derive from dataset if we can
        get its size
        """
```
not only it's broken, it's unreadable.

The original was:
```
        """
        number of training steps is either 
        1. args.max_steps if --max_steps > 1 
        2. else derive from dataset if we can get its size
        """
```

Ideally it should not remove new lines before bullets */- and numbers 1. 

I also am not sure why there is a need to merge lines when the writer meant them to be shorter. I get the shortening, but why can't short lines be left alone. Which would be the case in this example. It looks like the only way I can enforce readable content is to inject paragraphs.

Thank you!

@sgugger 

Comments:
The styling script does indeed break your list in this instance, which is kind of a bug that is a feature instead. Let me explain. If you use sphinx to convert this docstring to HTML, here is the result that it will produce:
![image](https://user-images.githubusercontent.com/35901082/103658226-ef827800-4f38-11eb-9388-7a311b30e00d.png)
So the styler is really only showing you in advance there is going to be a problem with your list when putting everything in the same paragraph.

To avoid the breaking (and properly rendering your list in the docs), you have to add a new empty line:
```
        """
        number of training steps is either 

        1. args.max_steps if --max_steps > 1 
        2. else derive from dataset if we can get its size
        """
```

I know it's a bit annoying for docstrings that are just there as internal documentation and not really designed to be shown in the main documentation, but the script can't guess which docstrings to check and which not...

> I also am not sure why there is a need to merge lines when the writer meant them to be shorter.

Again, this will be shown as one paragraph in the actual documentation. If you want to keep lines separated, they need to have an extra new line in-between.

Thank you for explaining that it is the sphinx that is lacking.

Could the autoformatter detect such situations and fix that so that it remains a list by inserting a new line, rather than unwrapping the whole thing?

If such a parser would be complicated we could make it easier by having a stricter format. Usually, in English a proper list is preceded by a colon as in:
```
Here is what you do:
1. ....
2. ....
```
So `r':\s*[\r\n]+\s+(\d+\.|[\-\*] )'` would match 3 types of lists.
Can't find pretrained model for TFPegasusForConditionalGeneration 
Author: demongolem
Pull request: no

## Environment info
- `transformers` version: 4.1.1
- Platform: Windows-10-10.0.18362-SP0
- Python version: 3.8.0
- PyTorch version (GPU?): 1.7.0+cu101 (True)
- Tensorflow version (GPU?): 2.3.1 (True)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help
 Pegasus: @patrickvonplaten

## Information

Model I am using (Bert, XLNet ...): pegasus-xsum

The problem arises when using:
* [X] my own modified scripts: (give details below)

The tasks I am working on is:
* [X] my own task or dataset: (give details below)

## To reproduce
Try to download model for TFPegasusForConditionalGeneration 

Steps to reproduce the behavior:

1. Choose pegasus-xsum model
2. Fetch pretrained model
3.

```
import tensorflow as tf
from transformers import TFPegasusForConditionalGeneration, PegasusTokenizer
src_text = [
    """ PG&E stated it scheduled the blackouts in response to forecasts for high winds amid dry conditions. The aim is to reduce the risk of wildfires. Nearly 800 thousand customers were scheduled to be affected by the shutoffs which were expected to last through at least midday tomorrow."""
]

model_name = 'google/pegasus-xsum'
tokenizer = PegasusTokenizer.from_pretrained(model_name)
model = TFPegasusForConditionalGeneration.from_pretrained(model_name)

batch = tokenizer.prepare_seq2seq_batch(src_text, truncation=True, padding='longest')
translated = model.generate(**batch)
tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True)

```
## Expected behavior

The model should download.  Instead the model cannot be found
`404 Client Error: Not Found for url: https://huggingface.co/google/pegasus-xsum/resolve/main/tf_model.h5
`

Comments:
Hey @demongolem, yes sadly those models were not yet uploaded in TF. Could you instead just run:

```python
import tensorflow as tf
from transformers import TFPegasusForConditionalGeneration, PegasusTokenizer
src_text = [
    """ PG&E stated it scheduled the blackouts in response to forecasts for high winds amid dry conditions. The aim is to reduce the risk of wildfires. Nearly 800 thousand customers were scheduled to be affected by the shutoffs which were expected to last through at least midday tomorrow."""
]

model_name = 'google/pegasus-xsum'
tokenizer = PegasusTokenizer.from_pretrained(model_name)
model = TFPegasusForConditionalGeneration.from_pretrained(model_name, from_pt=True)

batch = tokenizer.prepare_seq2seq_batch(src_text, truncation=True, padding='longest', return_tensors="tf")
translated = model.generate(**batch)
tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True)
```

Also note that you have to pass `return_tensors="tf"` in the tokenizer.

Thanks @patrickvonplaten .  The above code does do as necessary for me.  Thanks for pointing out the `return_tensors` part as well, I missed that one.
Improve documentation coverage for Herbert
Author: Qbiwan
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 #9035


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/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?

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 albert, bert, XLM: @LysandreJik
 GPT2: @LysandreJik, @patrickvonplaten
 tokenizers: @mfuntowicz
 Trainer: @sgugger
 Benchmarks: @patrickvonplaten
 Model Cards: @julien-c
 examples/distillation: @VictorSanh
 nlp datasets: [different repo](https://github.com/huggingface/nlp)
 rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
 Text Generation: @patrickvonplaten, @TevenLeScao
 Blenderbot, Bart, Marian, Pegasus: @patrickvonplaten
 T5: @patrickvonplaten
 Rag: @patrickvonplaten, @lhoestq
 EncoderDecoder: @patrickvonplaten
 Longformer, Reformer: @patrickvonplaten
 TransfoXL, XLNet: @TevenLeScao, @patrickvonplaten
 examples/seq2seq: @patil-suraj
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 FSMT: @stas00
 --> @sgugger


Comments:
Still not letting me assign you @sgugger :(
Improve documentation coverage for Phobert 
Author: Qbiwan
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 #9035


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/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 which 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.

 albert, bert, XLM: @LysandreJik
 GPT2: @LysandreJik, @patrickvonplaten
 tokenizers: @mfuntowicz
 Trainer: @sgugger
 Benchmarks: @patrickvonplaten
 Model Cards: @julien-c
 examples/distillation: @VictorSanh
 nlp datasets: [different repo](https://github.com/huggingface/nlp)
 rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
 Text Generation: @patrickvonplaten, @TevenLeScao
 Blenderbot, Bart, Marian, Pegasus: @patrickvonplaten
 T5: @patrickvonplaten
 Rag: @patrickvonplaten, @lhoestq
 EncoderDecoder: @patrickvonplaten
 Longformer, Reformer: @patrickvonplaten
 TransfoXL, XLNet: @TevenLeScao, @patrickvonplaten
 examples/seq2seq: @patil-suraj
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 FSMT: @stas00
 -->


Comments:
Can't pin you for review @sgugger, so tagging you!