Add gpt2-medium-chinese model card
Author: mymusise
Pull request: yes
Labels: name: model card

Hi,

this PR adds the model card for **gpt2-medium-chinese** model

Comments:
The Inference API is failing to load your model so there might be a configuration issue:

<img width="770" alt="Screenshot 2020-11-08 at 11 02 01" src="https://user-images.githubusercontent.com/326577/98462120-a5bb2280-217f-11eb-8777-8456534b99ef.png">

I suspect this line is not working: `tokenizer = AutoTokenizer.from_pretrained("mymusise/gpt2-medium-chinese")`

What kind of tokenizer are you using?

(cc @Narsil @JetRunner)

Well many models actually use BERT Chinese's tokenizer so maybe that's the case. If so, how can we combine the BERT tokenizer with GPT model? (I think we've handled similar situations before)

> The Inference API is failing to load your model so there might be a configuration issue:
> 
> <img alt="Screenshot 2020-11-08 at 11 02 01" width="770" src="https://user-images.githubusercontent.com/326577/98462120-a5bb2280-217f-11eb-8777-8456534b99ef.png">
> 
> I suspect this line is not working: `tokenizer = AutoTokenizer.from_pretrained("mymusise/gpt2-medium-chinese")`
> 
> What kind of tokenizer are you using?

Yes, I use BertTokenizer, but how can i change the Tokenizer and Model class of the default example?
```
from transformers import AutoTokenizer, TFAutoModelWithLMHead

tokenizer = AutoTokenizer.from_pretrained("mymusise/gpt2-medium-chinese")

model = TFAutoModelWithLMHead.from_pretrained("mymusise/gpt2-medium-chinese")
```
I specify `architectures=["TFGPT2LMHeadModel"]` on my configs, but it didn't show in the model card.

Is there any document I can reference?

> Well many models actually use BERT Chinese's tokenizer so maybe that's the case. If so, how can we combine the BERT tokenizer with GPT model? (I think we've handled similar situations before)

Yes, I have tried to use `GPT2Tokenizer` by specific `vocab_file` and `merges_file`, but it didn't work.
```
tokenizer = GPT2Tokenizer(vocab_file=my_vocab_file, merges_file=my_merges_file)
```
Is there any examples about how to custom GPT2Tokenizer that I can reference? Many thanks.

> > Well many models actually use BERT Chinese's tokenizer so maybe that's the case. If so, how can we combine the BERT tokenizer with GPT model? (I think we've handled similar situations before)
> 
> 
> 
> Yes, I have tried to use `GPT2Tokenizer` by specific `vocab_file` and `merges_file`, but it didn't work.
> 
> ```
> 
> tokenizer = GPT2Tokenizer(vocab_file=my_vocab_file, merges_file=my_merges_file)
> 
> ```
> 
> Is there any examples about how to custom GPT2Tokenizer that I can reference? Many thanks.

cc @julien-c 

Yes, see the doc here: https://huggingface.co/transformers/master/main_classes/configuration.html – look for `tokenizer_class`

In config.json:

> The name of the associated tokenizer class to use (if none is set, will use the tokenizer associated to the model by default).

> Yes, see the doc here: https://huggingface.co/transformers/master/main_classes/configuration.html – look for `tokenizer_class`
> 
> In config.json:
> 
> > The name of the associated tokenizer class to use (if none is set, will use the tokenizer associated to the model by default).


Thanks julien, I have added `tokenizer_class="BertTokenizer"` to [configs](https://s3.amazonaws.com/models.huggingface.co/bert/mymusise/gpt2-medium-chinese/config.json) and update it. But the web page still using `AutoTokenizer` as example. Cache?


The webpage will still display `AutoTokenizer` – but it will now work.

As you can see the Inference widget now works: https://huggingface.co/mymusise/gpt2-medium-chinese?text=%E6%88%91%E5%8F%AB%E6%9C%B1%E5%88%A9%E5%AE%89%EF%BC%8C%E6%88%91%E5%96%9C%E6%AC%A2

@julien-c I think many Chinese models in our hub have the same problem. I'll have them fixed.