Google Colab TypeError: expected str, bytes or os.PathLike object, not NoneType
Author: TatProg
Pull request: no

- `transformers` version: 4.5.1
- Platform: Linux-4.19.112+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.10
- PyTorch version (GPU?): 1.8.1+cu101 (False)
- Tensorflow version (GPU?): 2.4.1 (False)


Models I am using are **RoBERTa** (xlm-roberta-large) and **BERT** (bert-base-multilingual-cased)


### The problem arises when using:
In the beginning of April I started getting this error without any changes on my side. I just loaded my old Colab notebook (that worked well few months before that). Now I still getting this error and don't know what to do.


### The tasks I am working on is:
Just playing with models


### Steps to reproduce the behavior:
1. Open Google Colab
2. Run code below
3. Enjoy Error Message

```
!pip3 install transformers
import torch
from transformers import pipeline, XLMTokenizer, XLMWithLMHeadModel
model_bert = 'bert-base-multilingual-cased'
model_roberta = 'xlm-roberta-large'
tokenizer = XLMTokenizer.from_pretrained('xlm-roberta-large')
model = XLMWithLMHeadModel.from_pretrained('xlm-roberta-large')
```
```
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-5-09548189c94e> in <module>()
      4 model_bert = 'bert-base-multilingual-cased'
      5 model_roberta = 'xlm-roberta-large'
----> 6 tokenizer = XLMTokenizer.from_pretrained('xlm-roberta-large')
      7 model = XLMWithLMHeadModel.from_pretrained('xlm-roberta-large')

2 frames

/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py in from_pretrained(cls, pretrained_model_name_or_path, *init_inputs, **kwargs)
   1708 
   1709         return cls._from_pretrained(
-> 1710             resolved_vocab_files, pretrained_model_name_or_path, init_configuration, *init_inputs, **kwargs
   1711         )
   1712 

/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py in _from_pretrained(cls, resolved_vocab_files, pretrained_model_name_or_path, init_configuration, *init_inputs, **kwargs)
   1779         # Instantiate tokenizer.
   1780         try:
-> 1781             tokenizer = cls(*init_inputs, **init_kwargs)
   1782         except OSError:
   1783             raise OSError(

/usr/local/lib/python3.7/dist-packages/transformers/models/xlm/tokenization_xlm.py in __init__(self, vocab_file, merges_file, unk_token, bos_token, sep_token, pad_token, cls_token, mask_token, additional_special_tokens, lang2id, id2lang, do_lowercase_and_remove_accent, **kwargs)
    642         self.zh_word_tokenizer = None
    643 
--> 644         with open(vocab_file, encoding="utf-8") as vocab_handle:
    645             self.encoder = json.load(vocab_handle)
    646         self.decoder = {v: k for k, v in self.encoder.items()}

TypeError: expected str, bytes or os.PathLike object, not NoneType
```


Also, I tried to change 
from `tokenizer = XLMTokenizer.from_pretrained('xlm-roberta-large')`
to `tokenizer = XLMTokenizer.from_pretrained(model_roberta)`
or using another model `tokenizer = XLMTokenizer.from_pretrained('bert-base-multilingual-cased')`but got same error

Comments:
My issue is quite similar to #10756  

Hi! I believe you're using XLM models/tokenizers with XLM-R checkpoints. Have you tried using `XLMRobertaTokenizer` and `XLMRobertaLMHeadModel` instead?

You're also trying to load a BERT checkpoint in an XLM tokenizer, this won't work. If you want to load any checkpoint without worrying about the tokenizer/model architecture, I would recommend you use the `Auto*` instead:

```py
import torch
from transformers import pipeline, AutoTokenizer, AutoModelWithLMHead
model_bert = 'bert-base-multilingual-cased'
model_roberta = 'xlm-roberta-large'
tokenizer = AutoTokenizer.from_pretrained('xlm-roberta-large')
model = AutoModelWithLMHead.from_pretrained('xlm-roberta-large')
```

Thank you very much. Everything works well now! 

> Hi! I believe you're using XLM models/tokenizers with XLM-R checkpoints. Have you tried using `XLMRobertaTokenizer` and `XLMRobertaLMHeadModel` instead?
> 
> You're also trying to load a BERT checkpoint in an XLM tokenizer, this won't work. If you want to load any checkpoint without worrying about the tokenizer/model architecture, I would recommend you use the `Auto*` instead:
> 
> ```python
> import torch
> from transformers import pipeline, AutoTokenizer, AutoModelWithLMHead
> model_bert = 'bert-base-multilingual-cased'
> model_roberta = 'xlm-roberta-large'
> tokenizer = AutoTokenizer.from_pretrained('xlm-roberta-large')
> model = AutoModelWithLMHead.from_pretrained('xlm-roberta-large')
> ```

thank you a lot