yya518 / FinBERT

A Pretrained BERT Model for Financial Communications. https://arxiv.org/abs/2006.08097
Apache License 2.0
560 stars 128 forks source link

error when running FinBert Model Example.ipynb #14

Closed turmeric-blend closed 3 years ago

turmeric-blend commented 3 years ago

when running model.load_state_dict(torch.load(fine_tuned_weight_path, map_location=device)) from FinBert Model Example.ipynb from my local machine, I ran into this error:

RuntimeError: Error(s) in loading state_dict for BertClassification:
    Missing key(s) in state_dict: "bert.embeddings.position_ids".
yya518 commented 3 years ago

did you download the pre-trained and fine-tuned weights folder?

ReneeRuiFAN commented 3 years ago

I got the same error. And I downloaded the pre-trained and fine-tuned weights folder.

yya518 commented 3 years ago

I believe the error is related to the library version. The notebook was developed using pytorch-pretrained-bert==0.6.2. BTW, the model is now integrated with transformers. give it a try using the transformers interface.