lixin4ever/BERT-E2E-ABSA

NotImplementedError: Make sure `_init_weigths` is implemented (Error on Google Colab)

luishsantos opened this issue · 3 comments

!git clone https://github.com/lixin4ever/BERT-E2E-ABSA.git

!pip install transformers
!pip install tensorboardX
!python fast_run.py

I'm trying to run your model on colab with the previous steps, but it throws the following error:

2021-07-29 14:43:21.980960: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0
07/29/2021 14:43:23 - WARNING - main - Process rank: -1, device: cpu, n_gpu: 0, distributed training: False, 16-bits training: False
Traceback (most recent call last):
File "main.py", line 542, in
main()
File "main.py", line 432, in main
config=config, cache_dir='/content/.cache')
File "/usr/local/lib/python3.7/dist-packages/transformers/modeling_utils.py", line 1357, in from_pretrained
_fast_init=_fast_init,
File "/usr/local/lib/python3.7/dist-packages/transformers/modeling_utils.py", line 1455, in _load_state_dict_into_model
model._init_weights(module)
File "/usr/local/lib/python3.7/dist-packages/transformers/modeling_utils.py", line 579, in _init_weights
raise NotImplementedError(f"Make sure _init_weigths is implemented for {self.class}")
NotImplementedError: Make sure _init_weigths is implemented for <class 'absa_layer.BertABSATagger'>

how can I solve this?

Hey how did you fix it? @luishsantos

Hey how did you fix it? @luishsantos

%cd BERT-E2E-ABSA
!pip install -r requirements.txt

Instead of:
!pip install transformers
!pip install tensorboardX

This solved my problem! @chesed71

@luishsantos Thank for your quick answer, I already succeeded if i use lower transformer version, this issue didn't happen, but I want to use up to date transformers. so, I was curious how it can be solved. anyway, Thanks !!