add in layer gpt2 tokenizer
# What does this PR do?

- Adds in layer `TFGPT2Tokenizer` to enable serialization and serving it with TF Serving
- Small fixes on Tensorflow generation utils and GPT2 attentions to use `tf.shape` instead of `Tensor.shape` to solve max sequence length; and
- Explicitly unstacking the past key values on TF GPT2 Attention layer to avoid `None` shape issues that come with `generate` on TF compiled models.

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Addresses first step of #19992 


## Before submitting
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case. -> https://github.com/huggingface/transformers/issues/19992
- [x] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR 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:

- 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: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

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

 -->

_The documentation is not available anymore as the PR was closed or merged._<|||||>Just figured we have to solve some max lengths on the xla_tests. Changing the way we get the shapes broke some stuff. 

Tomorrow I'll fix it either on the method or on all the broken tests. Feel free to do it if anyone here is in a rush. <|||||>Actually, if you want I can handle the generate stuff on another PR, but IMHO it makes sense to keep it here, as it ensures the model will actually work along with the tokenizer. <|||||>Yeah, I would definitely keep any generate fixes that you need in this PR. Overall this looks extremely good, though, and great job figuring out a mapping from the existing BPE tokenizers to TF BPE that works!<|||||>Because this is touching the core library (by adding a `keras-nlp` dependency and an `is_keras_nlp_available()` check) and TF `generate()` code, I'm going to ping @sgugger and @gante to take a look too just to make sure it's all okay!<|||||>Yeah @Rocketknight1 actually I'm think that the generate thing can get bigger than this PR. Let me cut it out and open another PR for that.<|||||>Actually, just did it. Let's keep it simple and handle TF hell on another time. <|||||>Totally fine with that too - as long as it works for the core model we can add extra features over time. I'd love to see how many models in our codebase we could just copy-paste this new approach to as well!<|||||>@Rocketknight1 it works for the core model as per a test on this PR. Do you have any idea on why the add model like runner test is not passing? It seems related to some strange code quality check on a file I didn't change.<|||||>@piEsposito This happens sometimes - it's usually because you just happened to fork the repo at a bad time when that bug was present. The easiest way to fix these issues is just to rebase your PR and force push.

Also, since we're adding a new dependency here I want to wait to get a couple of reviews from the core team, but half the company is missing for Thanksgiving, so things might be a little slow with this PR until Monday! I definitely want to push to get it in for the next release, though.<|||||>@Rocketknight1 happy thanksgiving! 

All right, let me rebase it and we wait for the other folks to review it. Thank you for your support :D.<|||||>Should finish to address your review early next week. Stable Diffusion v2 got me into the rabbit hole haha. <|||||>btw @piEsposito if rebasing isn't fixing those tests, don't worry - they're very clearly in files totally untouched by this PR, so I'm happy to merge with them still red! Let me know whenever you're happy with the rest of the PR, and also note that we're planning a branch cut on Tuesday for the release, so this can go into the release if we merge before then!<|||||>@Rocketknight1 this should be finished today if I'm lucky. Thank you for understanding the red test thing.<|||||>@Rocketknight1 by mistake I removed you from the reviews, but I was actually trying to ask you to do one. I'm sorry.

@gante i've addressed your review.<|||||>@Rocketknight1 you can merge it now to keep it on the next release.

I will start trying to replicate this to other BPE tokenizers in the sequence.

Thank you, @gante and @sgugger for the kindness and support.