lixin4ever/BERT-E2E-ABSA

ImportError: cannot import name 'BERT_PRETRAINED_MODEL_ARCHIVE_MAP' from 'transformers'

lethienhoa opened this issue · 3 comments

Hi Li Xin,

Thank you for this repo !

I tried to replicate your result with the command 'python fast_run.py' and I encountered this problem.
It seems that this is a problem on transformer side. I tried to install it both by pip and from source (latest version 3.0.2) on Pytorch 1.2 (Ubuntu 20.04, Python 3.7, CUDA 11).
Did I miss something ? Do you have any idea why it happened ?
I searched over the internet and on forum hugging face but I do not see anyone evoke this problem.

Traceback (most recent call last):
File "main.py", line 12, in
from absa_layer import BertABSATagger, XLNetABSATagger
File "/home/hoa/BERT_E2E_ABSA/absa_layer.py", line 5, in
from bert import BertPreTrainedModel, XLNetPreTrainedModel
File "/home/hoa/BERT_E2E_ABSA/bert.py", line 19, in
from transformers import BERT_PRETRAINED_MODEL_ARCHIVE_MAP, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP
ImportError: cannot import name 'BERT_PRETRAINED_MODEL_ARCHIVE_MAP' from 'transformers' (/home/hoa/transformers/src/transformers/init.py)

Knowing that Transformer is well installed as it can do the following:

python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I hate you'))"
[{'label': 'NEGATIVE', 'score': 0.9991129040718079}]

Breaking change in newer version of transformer: huggingface/transformers#5842

Sorry for the late reply and thanks for your information~~

Hi @lixin4ever . I am trying to work around this error. I am still getting the following error.


from transformers import BERT_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP
ImportError: cannot import name 'BERT_PRETRAINED_MODEL_ARCHIVE_LIST' from 'transformers' (/opt/conda/lib/python3.7/site-packages/transformers/__init__.py)

Any help will be greatly appreciated.