yangheng95 / PyABSA

Sentiment Analysis, Text Classification, Text Augmentation, Text Adversarial defense, etc.;
https://pyabsa.readthedocs.io
MIT License
909 stars 153 forks source link

Error #30

Closed Astudnew closed 3 years ago

Astudnew commented 3 years ago

Hi Thanks for sharing your work I clon this repo into google colab ! git clone https://github.com/yangheng95/PyABSA and try to run sentiment_inference.py but I get this error:

2021-06-17 15:08:50.401786: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0 Traceback (most recent call last): File "/content/PyABSA/examples/aspect_polarity_classification/sentiment_inference.py", line 20, in sentiment_map=sentiment_map File "/usr/local/lib/python3.7/dist-packages/pyabsa/functional.py", line 95, in load_sentiment_classifier raise RuntimeError('Not a valid model path!') RuntimeError: Not a valid model path!

yangheng95 commented 3 years ago

you should download the trained model, which I released on google drive. and modify the trained model path in the code. feel free to contact me if any problems occurs.

yangheng95 commented 3 years ago

https://drive.google.com/drive/folders/1yiMTucHKy2hAx945lgzhvb9QeHvJrStC

Astudnew commented 3 years ago

Thanks I downloaded it and change and import the folders from my google drive and change path into /content/PyASBA/MyDrive/PYABSA/English/ATEPC/lcf_atepc_cdw_apcacc_83.66_apcf1_76.28_atef1_83.87 but I get this error: 2021-06-17 16:01:45.408614: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0 Load sentiment classifier from /content/PyASBA/MyDrive/PYABSA/English/ATEPC/lcf_atepc_cdw_apcacc_83.66_apcf1_76.28_atef1_83.87 /usr/local/lib/python3.7/dist-packages/pyabsa/module/apc/inferring/sentiment_classifier.py:87: UserWarning: Fail to load the model, please download our latest models at Google Drive: https://drive.google.com/drive/folders/1yiMTucHKy2hAx945lgzhvb9QeHvJrStC?usp=sharing warnings.warn('Fail to load the model, please download our latest models at Google Drive: ' Traceback (most recent call last): File "/content/PyABSA/examples/aspect_polarity_classification/sentiment_inference.py", line 20, in sentiment_map=sentiment_map File "/usr/local/lib/python3.7/dist-packages/pyabsa/functional.py", line 91, in load_sentiment_classifier infer_model = SentimentClassifier(trained_model_path, sentiment_map=sentiment_map) File "/usr/local/lib/python3.7/dist-packages/pyabsa/module/apc/inferring/sentiment_classifier.py", line 101, in init self.opt.inputs_cols = self.dataset.input_colses[self.opt.model_name] KeyError: 'lcf_atepc'

yangheng95 commented 3 years ago

please mind the type of the model, atepc model can extract aspects and predict sentiment, apc model can predict sentiment only, lcf-atepc is the atepc model, use this model in aspect-term-extracation example scripts