yangheng95 / PyABSA

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

AttributeError: 'ATEPCConfigManager' object has no attribute 'pretrained_bert_name' #56

Closed hitz02 closed 2 years ago

hitz02 commented 2 years ago

Error in running aspect extractor training example -

aspect_extractor = Trainer(config=config, dataset=tshirt, from_checkpoint=checkpoint_path, checkpoint_save_mode=1, auto_device=True )

yangheng95 commented 2 years ago

Heelo, I am working on testing the examples, can you show me the stacktrace to locate the error reason?

hitz02 commented 2 years ago

KeyError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/pyabsa/functional/config/config_manager.py in getattribute(self, arg_name) 60 try: ---> 61 value = super().getattribute('args')[arg_name] 62 args_call_count = super().getattribute('args_call_count')

KeyError: 'pretrained_bert_name'

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last) 5 frames

in () 4 from_checkpoint=checkpoint_path, 5 checkpoint_save_mode=1, ----> 6 auto_device=True 7 ) /usr/local/lib/python3.7/dist-packages/pyabsa/functional/trainer/trainer.py in __init__(self, config, dataset, from_checkpoint, checkpoint_save_mode, auto_device) 92 config.model_path_to_save = None 93 ---> 94 self.train() 95 96 def train(self): /usr/local/lib/python3.7/dist-packages/pyabsa/functional/trainer/trainer.py in train(self) 103 self.config.seed = s 104 if self.checkpoint_save_mode: --> 105 model_path.append(self.train_func(self.config, self.from_checkpoint, self.logger)) 106 else: 107 # always return the last trained model if dont save trained model /usr/local/lib/python3.7/dist-packages/pyabsa/core/atepc/training/atepc_trainer.py in train4atepc(opt, from_checkpoint_path, logger) 352 while not trainer: 353 try: --> 354 trainer = Instructor(opt, logger) 355 if from_checkpoint_path: 356 model_path = find_files(from_checkpoint_path, '.model') /usr/local/lib/python3.7/dist-packages/pyabsa/core/atepc/training/atepc_trainer.py in __init__(self, opt, logger) 58 } 59 ---> 60 self.tokenizer = AutoTokenizer.from_pretrained(self.opt.pretrained_bert_name, do_lower_case=True) 61 bert_base_model = AutoModel.from_pretrained(self.opt.pretrained_bert_name) 62 processor = ATEPCProcessor(self.tokenizer) /usr/local/lib/python3.7/dist-packages/pyabsa/functional/config/config_manager.py in __getattribute__(self, arg_name) 67 except Exception as e: 68 ---> 69 return super().__getattribute__(arg_name) 70 71 def __setattr__(self, arg_name, value): AttributeError: 'ATEPCConfigManager' object has no attribute 'pretrained_bert_name'
yangheng95 commented 2 years ago

OK, this is fixed just now in 1.0.7, which is cause by a rename of a parameter.

yangheng95 commented 2 years ago

I've tested all training and inference examples (passed in all situations), so I close this issue. But any error found could be reported, I would solve the problems as soon as possible.