Floating point exception (core dumped) when using `transformers.onnx`
### System Info

- `transformers` version: 4.22.2
- Platform: Linux-5.13.0-41-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.10.0
- PyTorch version (GPU?): 1.12.1+cu102 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No
### Who can help?

@LysandreJik

### 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

#### Code
```bash
python -m transformers.onnx --model=google/long-t5-tglobal-base --feature=seq2seq-lm onnx
```

#### Error Message
```bash
Validating ONNX model...
Floating point exception (core dumped)
```

#### Another Trial
Although the model isn't an official one, but it appears in the [document](https://huggingface.co/docs/transformers/model_doc/longt5#transformers.LongT5ForConditionalGeneration.forward.example). Showed the same message as above.
```bash
python -m transformers.onnx --model=Stancld/longt5-tglobal-large-16384-pubmed-3k_steps --feature=seq2seq-lm onnx
```

### Expected behavior

It shouldn't raise `Floating point exception (core dumped)`.
cc @lewtun <|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.