Fix PABEE & PL CI failure
Author: JetRunner
Pull request: yes

#6421 

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/6433?src=pr&el=h1) Report
> Merging [#6433](https://codecov.io/gh/huggingface/transformers/pull/6433?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/4ffea5ce2f4d154a3696b8fe2fb116fa09235700&el=desc) will **decrease** coverage by `2.51%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/6433/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/6433?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #6433      +/-   ##
==========================================
- Coverage   79.89%   77.37%   -2.52%     
==========================================
  Files         153      153              
  Lines       27902    27902              
==========================================
- Hits        22291    21588     -703     
- Misses       5611     6314     +703     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/6433?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/optimization.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9vcHRpbWl6YXRpb24ucHk=) | `25.55% <0.00%> (-70.00%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_distilbert.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9kaXN0aWxiZXJ0LnB5) | `34.11% <0.00%> (-63.30%)` | :arrow_down: |
| [src/transformers/pipelines.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9waXBlbGluZXMucHk=) | `26.98% <0.00%> (-52.81%)` | :arrow_down: |
| [src/transformers/optimization\_tf.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9vcHRpbWl6YXRpb25fdGYucHk=) | `33.33% <0.00%> (-24.33%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_auto.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9hdXRvLnB5) | `48.79% <0.00%> (-18.08%)` | :arrow_down: |
| [src/transformers/modeling\_auto.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19hdXRvLnB5) | `64.16% <0.00%> (-14.46%)` | :arrow_down: |
| [src/transformers/data/processors/squad.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL3Byb2Nlc3NvcnMvc3F1YWQucHk=) | `13.76% <0.00%> (-14.38%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_gpt2.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9ncHQyLnB5) | `65.68% <0.00%> (-6.16%)` | :arrow_down: |
| [src/transformers/modelcard.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGNhcmQucHk=) | `82.71% <0.00%> (-2.47%)` | :arrow_down: |
| [src/transformers/modeling\_distilbert.py](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19kaXN0aWxiZXJ0LnB5) | `96.19% <0.00%> (-1.64%)` | :arrow_down: |
| ... and [17 more](https://codecov.io/gh/huggingface/transformers/pull/6433/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/6433?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/6433?src=pr&el=footer). Last update [4ffea5c...cd1ca4c](https://codecov.io/gh/huggingface/transformers/pull/6433?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Ah, PL test still failing!

@LysandreJik Don't worry. It seems I mistype some parameter name

Oops! @sshleifer could you have a look at the PL example? I've tried tweaking the parameters but it doesn't seem to work.  

@stas00 Can you take a look? @sshleifer is on a vacation. Lots of thanks!

Yes, of course, I will be able to investigate in a few hours.

(we are talking about `examples/test_examples.py::ExamplesTests::test_run_pl_glue`)

I'm able to reproduce the problem of low `acc` with those changes proposed in this PR. This PR I get:
```
acc = 0.5
f1 = 0.666
```

The original pre-PR changes gives acc/f1=1.0 on my machine. 

If you have a look at https://github.com/huggingface/transformers/pull/6034 I tried various hparams to no avail, it was working fine on my machine, but CI kept on failing. It was just very counterproductive trying to experiment w/o being able to reproduce it locally, so after some time I gave up. So the test is not ideal, but at least it's testing that it runs.

@sshleifer said he was able to match the CI's low accuracy on his hardware (pre this PR).




@stas00 Yes I've already found the problem in #6034 (output_dir) and fixed that in our PR. However the accuracy is still too low compared to the trainer version of run_glue. Since you can now reproduce the low acc, please give it a look! 

Thank you for explaining what is happening, @JetRunner 

I have no perms to push, so try to use this:
```
        testargs = """
            run_pl_glue.py
            --model_name_or_path bert-base-cased
            --data_dir ./tests/fixtures/tests_samples/MRPC/
            --task mrpc
            --do_train
            --do_predict
            --output_dir ./tests/fixtures/tests_samples/pl_temp_dir
            --train_batch_size=32
            --learning_rate=1e-4
            --num_train_epochs=4
            --warmup_steps=3
            --seed=42
            --max_seq_length=128
            """.split()`
```
I get acc/f1 of 1.0 with this config, the key was more `--num_train_epochs` and some warm-up.

So you uncovered that these tests are very unreliable as they don't clean up after themselves and re-runs give invalid results. It's enough to get one run that succeeded, all the subsequent test re-runs will succeed at the moment. At the very least pl_glue needs to support `--overwrite_output_dir`.

That explains why I couldn't get CI to work, as mine probably wasn't working all along, other than succeeding once and then always reporting the old success. So I was getting false positives.

Should transformers warn a user when a pre-existing dir filled with outdated data is found or plainly refuse to run?


@stas00 this perm also outputs `0.5`, sadly. I feel maybe there's another bug here in the PL example? 
cc @LysandreJik @sshleifer  

PABEE's bug is fixed in #6453. The reproducible low acc is still existing for PL.
cc @LysandreJik @sshleifer