Errors when using fp16 with traced models
## 🐛 Bug

When I run

```
roberta_model = RobertaForMaskedLM.from_pretrained("roberta-base", torchscript=True)
roberta_model.cuda()
roberta_model.half()
traced_model = torch.jit.trace(roberta_model, (r_input_ids))
```

I get the following error

`
Expected object of scalar type Float but got scalar type Half for argument #2 'mat2'
`

When I attempt to load a normally traced model

```
loaded_model = torch.jit.load("traced_roberta_cuda.pt")
loaded_model.cuda()
loaded_model.half()
loaded_model(r_input_ids )
```

I get

`RuntimeError: expected device cuda:0 and dtype Float but got device cuda:0 and dtype Half
`

Is there a way to use fp16 with traced models? It happened with BertForSequenceClassification, RobertaForSequenceClassification and RobertaForMaskedLM.

## Environment
* Models tested on: Bert and Roberta:
* Language: English
* OS: Ubuntu 18.04
* Python version: 3.6.9
* PyTorch version: 1.2.0
* PyTorch Transformers version (or branch): 2.0.0

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
<|||||>Has this ever been solved? I have the same issue<|||||>I think maybe the reason is `.half()` only change(cast) the data, but it is not traceable. And there is no fp32 -> fp16 in python code, the function will expect fp32 input instead of fp16.<|||||>Just confirming I am still using this in production and never found a solution. If there is an easy solution here I'd happily pay a small bounty for the information.<|||||>Just stumbled across this trying to look for anything talking about using fp16 precision with torchscript. Converting the model and inputs to half seems to work. I get a lot higher warnings about loss of precision with torchscript when I have `use_fp16=True`.  Not sure if I'm being paranoid with the `torch.no_grad()` statement, I don't know if it'll do that internally within `torch.jit.trace` but I couldn't see anything about it.

```python
model = model.cuda()
model.eval()

with torch.no_grad():
    inputs = torch.randn(input_shape, device='cuda')
    
    if use_fp16:
        model = model.half()
        inputs = inputs.half()

    traced_model = torch.jit.trace(model, inputs)
```<|||||>It's kind of strange. When I don't check the trace during tracing and call inference without ``torch.no_grad()`` it does actually work (but consumes way too much memory of course because of gradient computations).

```
model.half()
model = torch.jit.trace(model, (dummy_input, dummy_input, dummy_input), check_trace=False)

outputs = model(inputs)
```

Actually I also have another issue with TorchScript, because I cannot feed the inputs as dict during tracing. In the case of BERT it then somehow uses ``input_ids, attention_mask, inputs`` as input names instead of ``input_ids, attention_mask, token_type_ids``.<|||||>For someone who encounters the same problem, this issue is fixed in torch 1.5 and present back in torch 1.6.