"index out of range in self" when calling BertForTokenClassification
Author: joawar
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->
     
- `transformers` version: 3.1.0
- Platform: Linux-5.4.0-42-generic-x86_64-with-glibc2.29
- Python version: 3.8.2
- PyTorch version (GPU?): 1.6.0 (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

### Who can help
<!-- Your issue 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, GPT2, XLM: @LysandreJik 

## Information

Model I am using (Bert, XLNet ...): BertForTokenClassification

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

1. Get input_ids, attention_masks, and labels, all of size [32,128] (more generally [batch_size, sequence_length]) from the current batch
2. Send all three inputs to the same device as the model
3. Run the model with the three inputs: ```loss = model(input_ids, attention_masks, labels)```

This is not the code I was running when I encountered the error but running this small chunk reproduces the error for me:

```python

from transformers import BertTokenizer, BertForTokenClassification
import torch as th

batch_size = 32
seq_len = 128

inputs = th.randint(2000, 3000, size=(batch_size, seq_len))
attention_mask = th.randint(0,1,size=(batch_size, seq_len))
labels = th.randint(0,17, size=(batch_size, seq_len))

model = BertForTokenClassification.from_pretrained('bert-base-uncased')
output = model(inputs, attention_mask, labels)
```
and then the error:
```
Traceback (most recent call last):
  File "test.py", line 15, in <module>
    output = model(inputs, attention_mask, labels)
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/transformers/modeling_bert.py", line 1488, in forward
    outputs = self.bert(
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/transformers/modeling_bert.py", line 824, in forward
    embedding_output = self.embeddings(
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/transformers/modeling_bert.py", line 209, in forward
    token_type_embeddings = self.token_type_embeddings(token_type_ids)
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/torch/nn/modules/sparse.py", line 124, in forward
    return F.embedding(
  File "/home/joakim/.virtualenvs/martino-replication/lib/python3.8/site-packages/torch/nn/functional.py", line 1814, in embedding
    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self
```

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

The model does the forward pass with the current batch and returns the output

<!-- A clear and concise description of what you would expect to happen. -->


## What I've looked at

From previous similar issues like #4153 there was one person who added special tokens to the tokenizer. I don't know what that means but I don't think I've done that. There was also a bug which was patched. In issue #2371 the problem was that a sequence of size greater than 512 was sent into the model. I've printed the size before sending it into the model, and the size is as expected [batch_size, sequence_length], where sequence_length <= 512, so that's not what's happening here either. Finally I tried making sequences of size 512 and sending into the model, in case for some reason the model expected sequence length 512 and nothing else, but as expected that didn't work.
 

Comments:
The issue is that you're passing a `labels` argument as the third argument, whereas it's the 10th argument, as you can see in the [documentation](https://huggingface.co/transformers/model_doc/bert.html#bertfortokenclassification).

You should do the following:

```py
output = model(inputs, attention_mask, labels=labels)
```