train_new_from_iterator missing from GPT2Tokenizer
## Environment info

- `transformers` version: 4.15.0
- Platform: Linux-5.4.144+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.12
- PyTorch version (GPU?): 1.10.0+cu111 (False)
- Tensorflow version (GPU?): 2.7.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
Library:

- Tokenizers: @LysandreJik

Examples:

- research_projects/codeparrot: @lvwerra 

## Information

Model I am using (Bert, XLNet ...): GPT2Tokenizer

The problem arises when using:
* [x] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

Was using the official research project script for codeparrto to train a new BPE tokenizer with the GPT2Tokenizer as the base: https://github.com/huggingface/transformers/blob/master/examples/research_projects/codeparrot/scripts/bpe_training.py

## To reproduce

Steps to reproduce the behavior: run the following colab: https://colab.research.google.com/drive/1G34QEjP9oNfcP_w_JO6DEnJuUTOsZe_D?usp=sharing

## Expected behavior

To be able to train a new GPT2Tokenizer from an iterator.
Just found if I use `AutoTokenizer` rather than the `GPT2Tokenizer` class it works. Is this expected? If so the codeparrot example will need to change.<|||||>The `train_new_from_iterator` works with fast tokenizers only. `GPT2Tokenizer` is a slow tokenizer, with `GPT2TokenizerFast` being its fast counterpart.<|||||>Thanks @ncoop57 for flagging and @LysandreJik  for pointing out the issue. That is a bug I introduced when switching from `AutoTokenizer` to `GPT2Tokenizer` - I'll fix this shortly.<|||||>Hi @lvwerra, I hate to say that it's still giving issues. I am on kaggle (ubuntu) with transformers 4.5.1 and tokenizers 0.10.3 and so even with fast tokenizers, it still says `has no attribute train_new_from_iterator...`<|||||>Hi @maulberto3, could you share a minimal reproducible example? Does it work with the latest transformers version?

**Update**: if I read the commit history correctly that feature was added in `v4.9.0` so you need to update the transformers library.<|||||>Hi @lvwerra You are right, I fixed the version and it works. Thanks.<|||||>What are the `parameters` inside `train_new_from_iterator`? Can I pass `frequency` inside it?
Also which `tokenizer` does  it trains? Is it `BPE `tokenizer?<|||||>Hi @pratikchhapolika, such questions are best asked in the forum [discuss.huggingface.co](discuss.huggingface.co) or you can have a look at the documentation [here](https://huggingface.co/docs/transformers/v4.20.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.train_new_from_iterator).