yya518 / FinBERT

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

For those of us without a CUDA compatible device: Note to use 'cpu' rather than 'cuda:1' as device. #21

Closed j4ffle closed 3 years ago

j4ffle commented 3 years ago

Thank you for providing us with your trained model! I finally have the fine-tuned model working on my machine. But after struggling for a long time, here are some notes that may help future users who like me have little experience with these types of models.

In working through your example for using the fine-tuned FinBERT, I had issues installing torch==1.2.0 until I first ran pip install pytorch-pretrained-bert, which did the installation of torch for me and eliminated that issue.

I do not have a CUDA compatible GPU and so had to change device='cuda:1' to device='cpu'. I then needed to add map_location=device or map_location='cpu' when running model.load_state_dict(torch.load(fine_tuned_weight_path,map_location=device)).

These are rather simple changes, but they held me up for some time.

yya518 commented 3 years ago

thanks. that's very helpful.

j4ffle commented 3 years ago

I really like the update. Much easier to implement and use. Thank you!!