ymcui / Chinese-BERT-wwm

Pre-Training with Whole Word Masking for Chinese BERT(中文BERT-wwm系列模型)
https://ieeexplore.ieee.org/document/9599397
Apache License 2.0
9.69k stars 1.39k forks source link

hfl/chinese-roberta-wwm-ext can not be loaded in Pytorch #133

Closed znsoftm closed 4 years ago

znsoftm commented 4 years ago

Besides hfl/chinese-roberta-wwm-ext, all of your models can be load into Pytorch with below code:

tokenizer = BertTokenizer.from_pretrained(MODENAME) roberta = BertModel.from_pretrained(MODENAME)

with model "hfl/chinese-roberta-wwm-ext", it complains

Exception has occurred: OSError Unable to load weights from pytorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

znsoftm commented 4 years ago

Sorry, I get it. Because of uncompleted download process. I purge all files in ~/.cache/torch then retry it , it works well.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.