warnings when converting WhisperModel to onnx format
Author: ling0322
Pull request: no

### System Info

transformers 4.25.1
torch 1.13.1+cu116
platform Windows 11

### Who can help?

@sanchit-gandhi 

### Information

When converting WhisperDecoder to onnx format. onnx.export will generate few warnings:
```
d:\run\whisper\transformers\models\whisper\modeling_whisper.py:753: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if input_shape[-1] > 1:
d:\run\whisper\transformers\models\whisper\modeling_whisper.py:74: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
  mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min))
d:\run\whisper\transformers\models\whisper\modeling_whisper.py:79: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if past_key_values_length > 0:
d:\run\whisper\transformers\models\whisper\modeling_whisper.py:200: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if attn_weights.size() != (bsz * self.num_heads, tgt_len, src_len):
d:\run\whisper\transformers\models\whisper\modeling_whisper.py:207: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if attention_mask.size() != (bsz, 1, tgt_len, src_len):
d:\run\whisper\transformers\models\whisper\modeling_whisper.py:239: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if attn_output.size() != (bsz * self.num_heads, tgt_len, self.head_dim):
```

### Reproduction

convert WhisperDecoder model to onnx format using `onnx.export`

### Expected behavior

No warning.

Comments:
cc @mht-sharma @fxmarty 

(this might be a more appropriate issue for the `optimum` repo: https://github.com/huggingface/optimum)

@ling0322 The ONNX export from transformers is deprecated and the ONNX export is now actively supported in Optimum.

The usage should be very similar, you can refer to the [documentation](https://huggingface.co/docs/optimum/v1.6.3/en/exporters/onnx/usage_guides/export_a_model) (version 1.6.3).

Feel free to open an issue in Optimum if you encounter an issue with the Whisper export!

FYI
Exporting via optimum results in same warnings

@frankiedrake Thank you for notifying. The only warning that is worth investigating is

```
  mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min))
d:\run\whisper\transformers\models\whisper\modeling_whisper.py:79: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
```

I'll have a look shortly.