UnboundLocalError: local variable 'extended_attention_mask' referenced before assignment
## Finetuning Setup
* Model: roberta-base
* Language: english
* OS: Ubuntu 18.04.3
* Python version: 3.7.3
* PyTorch version: 1.3.1+cpu
* PyTorch Transformers version (or branch): 2.2.0
* Using GPU ? No
* Distributed of parallel setup ? No
* Script inputs:
```
python run_lm_finetuning.py \
--output_dir=$OUTPUT_DIR \
--model_type=roberta \
--model_name_or_path=roberta_base \
--do_train \
--train_data_file=$TRAIN_FILE \
--do_eval \
--eval_data_file=$TEST_FILE \
--mlm \
--no_cuda
```

## ❓ Questions & Help
I finetuned roberta on some domain specific data I have and was trying to follow the example in the Quick Tour section for getting the output, however I get the following error:
```python
Traceback (most recent call last):
  File "/path/to/code/roberta_compare.py", line 26, in <module>
    last_hidden_states = model(input_ids)
  File "/usr/local/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/anaconda3/lib/python3.7/site-packages/transformers/modeling_roberta.py", line 246, in forward
    inputs_embeds=inputs_embeds)
  File "/usr/local/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/anaconda3/lib/python3.7/site-packages/transformers/modeling_bert.py", line 688, in forward
    extended_attention_mask = extended_attention_mask.to(dtype=next(self.parameters()).dtype)  # fp16 compatibility
UnboundLocalError: local variable 'extended_attention_mask' referenced before assignment
```
Here is my code:
```python
import torch
from transformers import RobertaTokenizer, RobertaForMaskedLM

model_class = RobertaForMaskedLM
model = model_class.from_pretrained('/path/to/models/roberta_finetuned/model')
tokenizer_class = RobertaTokenizer
tokenizer = tokenizer_class.from_pretrained('/path/to/models/roberta_finetuned/model')
tmp = tokenizer.encode('A sentence to encode with roberta.', add_special_tokens=True)
input_ids = torch.tensor(tmp)

with torch.no_grad():
    last_hidden_states = model(input_ids)[0]
```

Any thoughts on what I might be messing up?
You forgot to add the batch size.
You can either
- do `input_ids = tokenizer.encode('A sentence to encode with roberta.', add_special_tokens=True, return_tensors='pt')`
- or `input_ids = torch.tensor([tokenizer.encode('A sentence to encode with roberta.')])`

But for a specific reason, the current failure message is really not clear. Improving that in #2068<|||||>That fixes it! Thank you for the response! Closing the issue.