ScalaConsultants / Aspect-Based-Sentiment-Analysis

💭 Aspect-Based-Sentiment-Analysis: Transformer & Explainable ML (TensorFlow)
Apache License 2.0
539 stars 91 forks source link

Problem load `BERT-ADA` pretrained model #41

Open aurora1625 opened 3 years ago

aurora1625 commented 3 years ago

Hi, I want to say the work is really wonderful!

I installed the package and it works! Then I want to see if the other pretained model works, so I downloaded the BERT-ADA pretained model listed on README, specifically, I downloaded laptops_and_restaurants_2mio_ep15.

name = "/home/projects/pre_train_models/laptops_and_restaurants_2mio_ep15"
model = absa.BertABSClassifier.from_pretrained(name)

The error I got is:

OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5'] found in directory /home/projects/pre_train_models/laptops_and_restaurants_2mio_ep15 or `from_pt` set to False

Then I put in from_pt=True

name = "/home/projects/pre_train_models/laptops_and_restaurants_2mio_ep15"
model = absa.BertABSClassifier.from_pretrained(name, from_pt=True)

This time I got AttributeError: 'BertConfig' object has no attribute 'num_polarities'.

I am quite new to this area and experimenting, could you help to solve the issue?

Another question is, where the model is stored? I couldn't find absa/classifier-lapt-0.2 in package folder, or anywhere. I looked at the load.py file, it is supposed to download to a download folder, but I also can't find it. If I find it, I may compare the config.json file with other model.

I have created two conda env, one with transformers==4.2 and another with transformers=2.5, both has the same error indicated above.

Thank you very much!

heyeolasad commented 3 years ago

When I try to load a pretrained model I get the same error. Any solutions?