[cleanup] Hoist ModelTester objects to toplevel
https://github.com/huggingface/transformers/pull/4046#issuecomment-628236744


many `ModelTester` objects are defined within classes. If we move them to the top level of the module, we can share code where possible and also have less complexity.

The task here is to move `ModelTester` objects to the top level.
Bonus: if the kwargs are never used, replace

```python
def__init(self, num_layers=2):
    self.num_layers=num_layers
```
with
```python
def__init(self):
    self.num_layers=2
```


@sshleifer It would be beneficial to provide more context, apologies for the beginner question!
Would be happy to pick it up :)<|||||>Yeah sure. The high level goal is to reduce the amount of boilerplate code in the unittests.

For example, if you look at [T5ModelTester](https://github.com/huggingface/transformers/blob/master/tests/test_modeling_t5.py#L43), there are a few code quality issues:
1) The class is defined inside `T5ModelTest` class and indented. It should be defined outside. 
2) The class inherits from `object`. It should not.
3) the class has 18 lines of keyword arguments that are never used. They should be hardcoded. For example, instead of lines 47 (`batch_size=13`) and line 68, (`self.batch_size=batch_size`), we could simply set `self.batch_size = 13` in one line.


These 3 problems occurr in nearly all of the following files:

```bash
git grep "ModelTester(object)"
```
Results:
```bash

tests/test_modeling_albert.py:    class AlbertModelTester(object):
tests/test_modeling_ctrl.py:    class CTRLModelTester(object):
tests/test_modeling_distilbert.py:    class DistilBertModelTester(object):
tests/test_modeling_electra.py:    class ElectraModelTester(object):
tests/test_modeling_flaubert.py:    class FlaubertModelTester(object):
tests/test_modeling_gpt2.py:    class GPT2ModelTester(object):
tests/test_modeling_longformer.py:class LongformerModelTester(object):
tests/test_modeling_openai.py:    class OpenAIGPTModelTester(object):
tests/test_modeling_roberta.py:    class RobertaModelTester(object):
tests/test_modeling_t5.py:    class T5ModelTester(object):
tests/test_modeling_tf_albert.py:    class TFAlbertModelTester(object):
tests/test_modeling_tf_bert.py:    class TFBertModelTester(object):
tests/test_modeling_tf_ctrl.py:    class TFCTRLModelTester(object):
tests/test_modeling_tf_distilbert.py:    class TFDistilBertModelTester(object):
tests/test_modeling_tf_electra.py:    class TFElectraModelTester(object):
tests/test_modeling_tf_gpt2.py:    class TFGPT2ModelTester(object):
tests/test_modeling_tf_openai_gpt.py:    class TFOpenAIGPTModelTester(object):
tests/test_modeling_tf_roberta.py:    class TFRobertaModelTester(object):
tests/test_modeling_tf_t5.py:    class TFT5ModelTester(object):
tests/test_modeling_tf_transfo_xl.py:    class TFTransfoXLModelTester(object):
tests/test_modeling_tf_xlm.py:    class TFXLMModelTester(object):
tests/test_modeling_tf_xlnet.py:    class TFXLNetModelTester(object):
tests/test_modeling_transfo_xl.py:    class TransfoXLModelTester(object):
tests/test_modeling_xlm.py:    class XLMModelTester(object):
tests/test_modeling_xlnet.py:    class XLNetModelTester(object):
```

Once this is done, we can update the instructions in
```bash
templates/adding_a_new_model/tests/test_modeling_tf_xxx.py
templates/adding_a_new_model/tests/test_modeling_xxx.py
```<|||||>Indeed, code quality could be improved here!