Difference between AutoTokenizer.from_pretrained and BertTokenizer.from_pretrained
# ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. Make sure to tag your question with the
     right deep learning framework as well as the huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     
     If your question wasn't answered after a period of time on Stack Overflow, you
     can always open a question on GitHub. You should then link to the SO question 
     that you posted.
     -->

While loading pretrained BERT model, what's the difference between AutoTokenizer.from_pretrained and BertTokenizer.from_pretrained? I'm very new to transformers and still confused about some basic things.
Thanks. 
<!-- Description of your issue -->

<!-- You should first ask your question on SO, and only if
     you didn't get an answer ask it here on GitHub. -->
**A link to original question on Stack Overflow**:

Hi! The [documentation](https://huggingface.co/transformers/model_doc/auto.html) mentions:

> In many cases, the architecture you want to use can be guessed from the name or the path of the pretrained model you are supplying to the from_pretrained method.
> 
> AutoClasses are here to do this job for you so that you automatically retrieve the relevant model given the name/path to the pretrained weights/config/vocabulary:
> 
> Instantiating one of AutoModel, AutoConfig and AutoTokenizer will directly create a class of the relevant architecture (ex: model = AutoModel.from_pretrained('bert-base-cased') will create a instance of BertModel).

So if the string with which you're calling `from_pretrained` is a BERT checkpoint (like `bert-base-uncased`), then this:

```py
AutoTokenizer.from_pretrained("bert-base-uncased")
```
is the same as this:
```py
BertTokenizer.from_pretrained("bert-base-uncased")
```

However, `Auto*` are more flexible as you can specify any checkpoint and the correct model will be loaded, e.g.:

```py
AutoTokenizer.from_pretrained("gpt2")  # works and returns the correct GPT2Tokenizer instance
BertTokenizer.from_pretrained("gpt2")  # fails
```

Closing this for now, let me know if you have other questions.<|||||>@LysandreJik 

I'm trying to recreate the  
```train_new_from_iterator``` 
method from the 
```class PreTrainedTokenizerFast(PreTrainedTokenizerBase)```
class

But the class that we have for training is different

```
auto = transformers.AutoTokenizer.from_pretrained("bert-base-cased")
print(type(auto))
<class 'transformers.models.bert.tokenization_bert_fast.BertTokenizerFast'>
```

What is the correct way to do so?<|||||>very nice Infromation AutoTokenizer