GPT2 saved pb file cannot handle dynamic sequence length
Author: sufengniu
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.6.1
- Platform: Darwin-20.4.0-x86_64-i386-64bit
- Python version: 3.7.7
- PyTorch version (GPU?): 1.7.1 (False)
- Tensorflow version (GPU?): 2.4.1 (False)
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: no

### Who can help
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models: gpt2 @patrickvonplaten, @LysandreJik

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @Rocketknight1

Library: 

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

Model hub:

- for issues with a model report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

Model I am using (Bert, XLNet ...):

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [ ] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

```python3
import tensorflow as tf
import tensorflow_hub as hub
from transformers import GPT2Tokenizer, TFGPT2Model 
tokenizer = GPT2Tokenizer.from_pretrained('gpt2') 
model = TFGPT2Model.from_pretrained('gpt2') 
tf.saved_model.save(model, "gpt2")
model_hub = hub.KerasLayer("gpt2")
text = "Replace me by any text you'd like." 
encoded_input = tokenizer(text, return_tensors='tf') 
output = model_hub(encoded_input)
```
It would complain the input mismatched, where input is [None, 5], I think 5 is dummy input defined inside the file_utils.py. In other word, does gpt2 saved tf hub model must be fixed length (dummy input length)?

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

Should run without issue after loading tfhub
<!-- A clear and concise description of what you would expect to happen. -->


Comments:
Hi! As far as I'm aware, we don't support TF Hub integrations right now. If you want to save or load a TF2 model from Transformers, you can use the `save_pretrained` method like so:

```
from transformers import GPT2Tokenizer, TFGPT2Model

tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = TFGPT2Model.from_pretrained('gpt2')
model.save_pretrained("saved_gpt2")
new_model = TFGPT2Model.from_pretrained('saved_gpt2')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = new_model(encoded_input)
```

I'm the TF maintainer here, and one of the things I'm actively working on is making our Tensorflow support cleaner and more idiomatic. If there's a reason you really want to export to the TF Hub or normal Keras formats, please let us know, and we'll take that into account when planning development!

Hello @Rocketknight1 

Thank you, I think export to tf hub is an important feature if you want to deploy to real production. as far as I know, many companies they would not use saved model weights, but rather do serving with packed computational graph. Therefore, it would be great if you could take tf hub export into account in the future. will close this ticket, by the way, do you want me open another one regarding to feature request?

Thank you!