Using GPT2 tokenizer with DataCollatorForLanguageModeling
### System Info

- `transformers` version: 4.21.3
- Platform: Linux-5.10.0-18-amd64-x86_64-with-glibc2.31
- Python version: 3.9.12
- Huggingface_hub version: 0.9.1
- PyTorch version (GPU?): 1.12.1 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed

### Who can help?

@SaulLu @patil-suraj @patrickvonplaten 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

```python
from transformers import AutoTokenizer, AutoModelForCausalLM, DataCollatorForLanguageModeling

model = AutoModelForCausalLM.from_pretrained("nferruz/ProtGPT2")
tokenizer = AutoTokenizer.from_pretrained("nferruz/ProtGPT2")
tokenizer.pad_token = tokenizer.eos_token

data_collator = DataCollatorForLanguageModeling(tokenizer = tokenizer, mlm=False)

list_of_seqs = ['GLWSKIKEVGKEAAKAAAKAAGKAALGAVSEAV', 'DGVKLCDVPSGTWSGHCGSSSKCSQQCKDREHFAYGGACHYQFPSVKCFCKRQC']

tokens = tokenizer(list_of_seqs, padding = True, return_tensors='pt', return_special_tokens_mask=True)
collated = data_collator(tokens)
```

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zachmartinez/miniconda3/lib/python3.9/site-packages/transformers/data/data_collator.py", line 42, in __call__
    return self.torch_call(features)
  File "/home/zachmartinez/miniconda3/lib/python3.9/site-packages/transformers/data/data_collator.py", line 732, in torch_call
    "input_ids": _torch_collate_batch(examples, self.tokenizer, pad_to_multiple_of=self.pad_to_multiple_of)
  File "/home/zachmartinez/miniconda3/lib/python3.9/site-packages/transformers/data/data_collator.py", line 404, in _torch_collate_batch
    length_of_first = examples[0].size(0)
AttributeError: 'tokenizers.Encoding' object has no attribute 'size'
```





### Expected behavior

I would expect that the collator would accept the tokenizer output and perform the collating. Any help would be appreciated.
The data collator will expect a list of samples from a torch Dataset, but you are passing a single dictionary to it (the output of the tokenizer is one dictionary, with the keys being the arguments expected by the models like `input_ids`, and the values being tensors).

You can actually do directly `model(**tokens)`, you don't need the data collator on this example.<|||||>Thank you very much for your quick response! I'm simply trying to fine-tune the model with CLM, so I figured I needed to use the datacollator.