TypeError: object of type 'WindowsPath' has no len()
Hi, when I run "tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')", the error "TypeError: object of type 'WindowsPath' has no len()" occurs, what is the problem? Thank you for your excellent code!
Can you post a more detailed log?<|||||>I install your PyTorch pretrained bert with pip like "pip install pytorch-pretrained-bert", then I run the code in Usage section like:

`import torch`
`from pytorch_pretrained_bert import BertTokenizer, BertModel, BertForMaskedLM`

`# Load pre-trained model tokenizer (vocabulary)`
`tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')`

but there is an error occurs, the error information is: 

Traceback (most recent call last):

  File "<ipython-input-2-7725148c607d>", line 5, in <module>
    tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

  File "C:\Users\Deep\Anaconda3\lib\site-packages\pytorch_pretrained_bert\tokenization.py", line 117, in from_pretrained
    resolved_vocab_file = cached_path(vocab_file, cache_dir=cache_dir)

  File "C:\Users\Deep\Anaconda3\lib\site-packages\pytorch_pretrained_bert\file_utils.py", line 88, in cached_path
    return get_from_cache(url_or_filename, cache_dir)

  File "C:\Users\Deep\Anaconda3\lib\site-packages\pytorch_pretrained_bert\file_utils.py", line 169, in get_from_cache
    os.makedirs(cache_dir, exist_ok=True)

  File "C:\Users\Deep\Anaconda3\lib\os.py", line 226, in makedirs
    head, tail = path.split(name)

  File "C:\Users\Deep\Anaconda3\lib\ntpath.py", line 204, in split
    d, p = splitdrive(p)

  File "C:\Users\Deep\Anaconda3\lib\ntpath.py", line 139, in splitdrive
    if len(p) >= 2:

TypeError: object of type 'WindowsPath' has no len()<|||||>Strange error. I am only using standard library here. Maybe it has something to do with your installation of Conda. You can try to manually specify a cache directory for the package by either:
- setting the environment variable `PYTORCH_PRETRAINED_BERT_CACHE=XXX` to a directory `XXX` you created to store the downloaded models.
- sending the path to this directory to the tokenizer and model using the `cache_dir=XXX` arguments, for example: `tokenizer = BertTokenizer.from_pretrained('bert-base-uncased', cache_dir=XXX)`<|||||>I follow your second instruction and change the code to:

`tokenizer = BertTokenizer.from_pretrained('bert-base-uncased', cache_dir='C:/Users/Deep/Anaconda3/Lib/site-packages')`

It works! Thank you!
