MT5-large model on hub has wrong config
MT5-large model [config](https://huggingface.co/google/mt5-large/blob/main/config.json) has wrong parameters `"architectures"` and `"tokenizer_class"` as

```json
{
  "architectures": [
    "T5ForConditionalGeneration"
  ],
  "tokenizer_class": "T5Tokenizer"
}
```

, where it should be MT5 arch and tokenizer as

```json
{
  "architectures": [
    "MT5ForConditionalGeneration"
  ],
  "tokenizer_class": "MT5Tokenizer"
}
```

@patrickvonplaten  
great catch! Correcting it now<|||||>Reopening in 4.9.2 since it is difficult to read the model. The problem is either here:
https://github.com/huggingface/transformers/blob/v4.9.2/src/transformers/models/auto/tokenization_auto.py#L329 in`TOKENIZER_MAPPING` or here https://github.com/huggingface/transformers/blob/v4.9.2/src/transformers/models/mt5/__init__.py#L35

`MT5Tokenizer` is just `T5Tokenizer` so when we call `class.__name__` it reduces to `T5Tokenizer` and `MT5Tokenizer` is not in the list. The trick however is to pass `tokenizer_class=None` to `from_pretrained` and it reduces to `T5Tokenizer`:
```
AutoTokenizer.from_pretrained(
            "google/mt5-large",
            tokenizer_class=None,
        )
```
Now, it works on master though.<|||||>@dkajtoch mt5-large tokenizer class is incorrect in config.json: https://huggingface.co/google/mt5-large/blob/main/config.json
It should be corrected as `"tokenizer_class": "T5Tokenizer",`.

Refer to mt5-base https://huggingface.co/google/mt5-base/blob/main/config.json and mt5-xl https://huggingface.co/google/mt5-xl/blob/main/config.json configs.<|||||>@dkajtoch interesting catch, but I do not understand why this problem is happening ? 

Isn't `MT5Tokenizer` is already in the autotokenizer's list (as an alias for `T5Tokenizer`) ? @patrickvonplaten <|||||>@devrimcavusoglu it is but the class is not called `MT5Tokenizer`. It would have been if the authors did something like this
```
class MT5Tokenizer(T5Tokenizer):
   pass
```
Instead of `MT5Tokenizer = T5Tokenizer`

because `tokenizer_class_from_name ` matches tokenizer via reference to class name i.e. `c.__name__`<|||||>> @devrimcavusoglu it is but the class is not called `MT5Tokenizer`. It would have been if the authors did something like this
> 
> ```
> class MT5Tokenizer(T5Tokenizer):
>    pass
> ```
> 
> Instead of `MT5Tokenizer = T5Tokenizer`
> 
> because `tokenizer_class_from_name ` matches tokenizer via reference to class name i.e. `c.__name__`

My mistake, I thought `MT5Tokenizer` was a class exactly like you said :sweat_smile: turns out I remember incorrectly. So the next step would be

1) create a class for `MT5Tokenizer` rather than a variable. 
2) change `"tokenizer_class": "MT5Tokenizer"` as `"tokenizer_class": "T5Tokenizer"` in mt5 model configs.

I think (1) is more solid and nicer way. wdyt ? @patrickvonplaten @dkajtoch<|||||>Maybe the fix is necessary or maybe not since on master 4.10.0-dev0 it works by switching to T5Tokenizer. However, all previous versions will be broken so it is better to change the config back -> only large has `MT5Tokenizer` :P<|||||>@dkajtoch previous mt5-large config was incorrect. If you switch it back, it will work incorrectly.

You only need to fix tokenizer class in mt5-large config as `"tokenizer_class": "T5Tokenizer",`.<|||||>@fcakyon I see in history that not only tokenizer_class was changed 👍 Ok so just the tokenizer_class needs to be updated in config.json<|||||>@dkajtoch thats right 👍 <|||||>@dkajtoch @patrickvonplaten any ETA on the fix?<|||||>Sorry what's the problem here exactly? 

```python
tok = AutoTokenizer.from_pretrained("google/mt5-large")
``` 

works fine when I try it.<|||||>`MT5Tokenizer` is an alias to `T5Tokenizer`, so it doesn't really matter which one we put in the config. For consistency, it's True that `T5Tokenizer` might make more sense<|||||>![image](https://user-images.githubusercontent.com/32985207/129199066-94e41d2e-f5dd-4722-9397-915ced3d652d.png)
@patrickvonplaten This happens at most in `4.9.2` and the current master version is ok.
<|||||>Gotcha! Thanks for clarifying! Updating the config now<|||||>Done! Sorry about that!