Hubconf
fixes #504 
Also add hubconf for bert related tokenizer & models. 
There're a few GPT models and transformer models, but would like to send this out to get a review first. 
Also there's possibility to unify the cache dir with pytorch one. 
Hi @ailzhang,
This is great! I went through it and it looks good to me.

I guess we should update the `from_pretrained` method of the other models as well (like [here](https://github.com/huggingface/pytorch-pretrained-BERT/blob/19666dcb3bee3e379f1458e295869957aac8590c/pytorch_pretrained_bert/modeling_openai.py#L420))

Do you want to have a look at the other models (GPT, GPT-2 and Transformer-XL) and add them to the `hubconf.py` as well ?<|||||>Hi @thomwolf, thanks for the quick reply! Yea we definitely would like to add GPT and Transformer-XL models in. 

I can definitely add them in this PR myself. Alternatively one thing could be super helpful to us would be someone from your team try out implementing a few models using `torch.hub` interfaces and let us know if you see any bugs/issues from a repo owner perspective :D. Let me know which way you prefer, thanks! 

 Another question is about cache dir, pytorch has move to comply with XDG specification about caching dirs(https://github.com/pytorch/pytorch/issues/14693). Detailed logic can be found here https://pytorch.org/docs/master/hub.html#where-are-my-downloaded-models-saved ( I will fix the doc formatting soon :P ) Are you interested in moving to be in the same place? Happy to help on it as well. 
<|||||>@thomwolf  Any update on this? ;)  Thanks!<|||||>Hi @ailzhang, sorry for the delay, here are some answers to your questions:

- `torch.hub`: I can give it a try but the present week is fully packed. I'll see if I can free some time next week. If you want to see it reach `master` faster, I'm also fine with you adding the other models.

One question I have here is that the pretrained models cannot really be used without the associated tokenizers. How is this supposed to work with `torch.hub`? Can you give me an example of usage (like the one in the readme for instance)?

- update to `cache dir`: XDG specification seems nice indeed. If you want to give it a try it would be a lot cleaner than the present caching setting I guess.

Related note: we (Sebastian Ruder, Matthew Peters, Swabha Swayamdipta and I) are preparing a [tutorial on Transfer Learning in NLP to be held at NAACL](https://naacl2019.org/program/tutorials). We'll show various frameworks in action. I'll will see if we can include a `torch.hub` example.<|||||>@thomwolf 
Note that there's a tokenizer in hub already. Typically we'd prefer hub only contains models, but in this case we also includes tokenizer as it's a required part. 
There's an example in docstring of  BertTokenizer. Is this good enough? 
```
        >>> sentence = 'Hello, World!'
        >>> tokenizer = torch.hub.load('ailzhang/pytorch-pretrained-BERT:hubconf', 'bertTokenizer', 'bert-base-cased', do_basic_tokenize=False, force_reload=False)
        >>> toks = tokenizer.tokenize(sentence)
        ['Hello', '##,', 'World', '##!']
        >>> ids = tokenizer.convert_tokens_to_ids(toks)
        [8667, 28136, 1291, 28125]
```
Maybe we can merge this PR first if it looks good? 
<|||||>Oh indeed, I missed the tokenizer.
Ok let's go with this PR!