Exporting TensorFlow models to ONNX exports with a static batch size of 2 and sequence length of 8
### System Info

- `transformers` version: 4.22.0
- Platform: Darwin-21.6.0-x86_64-i386-64bit
- Python version: 3.7.12
- Huggingface_hub version: 0.10.0
- PyTorch version (GPU?): not installed (NA)
- Tensorflow version (GPU?): 2.8.0 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: NA
- Using distributed or parallel set-up in script?: NA


### Who can help?

@Rocketknight1

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

With `tensorflow` and `onnx` installed, run 
`python -m transformers.onnx --model=bert-base-uncased --feature=sequence-classification onnx/`

along with a simple script to test the exported model

```py
import numpy as np
from transformers import AutoTokenizer
from onnxruntime import InferenceSession


tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
session = InferenceSession("./onnx/model.onnx")

inputs = tokenizer(["A string", "A longer string", "An even longer string"], return_tensors="np", padding=True)
inputs = {k: v.astype(np.int32) for k, v in inputs.items()}

print(session.run(output_names=["logits"], input_feed=dict(inputs)))
```

This raises the error:
```
InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: token_type_ids for the following indices
 index: 0 Got: 3 Expected: 2
 index: 1 Got: 6 Expected: 8
 Please fix either the inputs or the model.
```

because we use the TensorSpec from the dummy inputs here https://github.com/huggingface/transformers/blob/0fc68a7e14b1e6450829e7be76f74abbc84f051e/src/transformers/onnx/convert.py#L265

### Expected behavior

This issue is related to https://github.com/huggingface/transformers/issues/16885 which was a feature request for setting the batch size and sequence size, but I'm not sure we want this to be configurable. Arguably, it should be at parity with the PyTorch -> onnx capability which configures dynamic batch size and and sequence length set by the model. Therefore I'm marking this as a bug instead of a feature request

Expected behavior is that the exported onnx model runs with any batch size and up to the model's max sequence length
@dwyatte Can you please look into #19231? Somehow the sequence length is capped to 5 tokens in the generated tflite. tflite files are used to run models on mobile devices. 

Since your issue also has a fixed sequence length, the cause may be related. I tried converting BERT to tflite and the input size was 1x5, as with other models.

Please look into this if you can. Thanks for your time! :)