Open sqs17 opened 6 months ago
and when i add "config.hidden_dim = 768"
error is :
Traceback (most recent call last):
File "c:\PyABSA-2\yelp\test.py", line 57, in
I downloaded the model locally, using microsoft\deberta-v3-base
Its my checkpoints.
This seems to have something to do with the training data set. I successfully fine-tuned the training data when I used 119.Yelp and 133.finNews, but I reported errors when I used my own data set and 99.PoliticalData. 99.PoliticalData has dimension 4, and my dataset has dimension 1
Please make sure that your datasets contains the same number of the labels as the pretrained model you are going to use. If the number of labels are not equal, please try fine-tuning the model based on merely your own dataset.
Hello, thank you very much for your answer. The task I want to do now is to extract the aspect level of each sentence and conduct sentiment analysis. A sentence corresponds to multiple aspect levels. I don't quite understand the meaning of the number of labels, doesn't every sentence correspond to one aspect? If it corresponds to multiple aspects, repeat the sentence. Thanks again for your help.
是指这里的output_dim吗
Thanks for your suggestion, after modifying self.output_dim, my code runs well. Is this because the result of the pre-trained model is a triplet of this type? But my data is consistent with the data structure of the pre-trained model.
Version See the console output for PyABSA, Torch, Transformers Version 2.4.1.post1
Describe the bug A clear and concise description of what the bug is. Traceback (most recent call last): File "D:\anaconda\envs\pyabsa2\lib\site-packages\pyabsa\framework\configuration_class\configuration_template.py", line 45, in getattribute value = super().getattribute("args")[arg_name] KeyError: 'hidden_dim'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\PyABSA-2\yelp\test.py", line 56, in
trainer = ATEPC.ATEPCTrainer(
File "D:\anaconda\envs\pyabsa2\lib\site-packages\pyabsa\tasks\AspectTermExtraction\trainer\atepc_trainer.py", line 69, in init
self._run()
File "D:\anaconda\envs\pyabsa2\lib\site-packages\pyabsa\framework\trainer_class\trainer_template.py", line 240, in _run
model_path.append(self.training_instructor(self.config).run())
File "D:\anaconda\envs\pyabsa2\lib\site-packages\pyabsa\tasks\AspectTermExtraction\instructor\atepc_instructor.py", line 40, in init
self._load_dataset_and_prepare_dataloader() File "D:\anaconda\envs\pyabsa2\lib\site-packages\pyabsa\tasks\AspectTermExtraction\instructor\atepc_instructor.py", line 252, in _load_dataset_and_prepare_dataloader self.model = self.config.model(self.bert_base_model, config=self.config) File "D:\anaconda\envs\pyabsa2\lib\site-packages\pyabsa\tasks\AspectTermExtraction\models__lcf\fast_lcf_atepc.py", line 31, in init__
self.linear_double = nn.Linear(config.hidden_dim * 2, config.hidden_dim) File "D:\anaconda\envs\pyabsa2\lib\site-packages\pyabsa\framework\configuration_class\configuration_template.py", line 52, in getattribute return super().getattribute(arg_name) AttributeError: 'ATEPCConfigManager' object has no attribute 'hidden_dim'
Code To Reproduce Paste buggy code here from pyabsa import DatasetItem my_dataset = DatasetItem("atepc_datasets", ["428.test"])
my_dataset1 and my_dataset2 are the dataset folders. In there folders, the train dataset is necessary
dataset = my_dataset print(dataset)
from pyabsa import * config = ( ATEPC.ATEPCConfigManager.get_atepc_config_english() ) # this config contains 'pretrained_bert', it is based on pretrained models config.model = ATEPC.ATEPCModelList.FAST_LCF_ATEPC # improved version of LCF-ATEPC
from pyabsa import ModelSaveOption, DeviceTypeOption import warnings
warnings.filterwarnings("ignore")
config.batch_size = 16 config.patience = 2 config.log_step = -1 config.seed = [1] config.verbose = False # If verbose == True, PyABSA will output the model strcture and seversal processed data examples config.notice = ( "This is an training example for aspect term extraction" # for memos usage )
trainer = ATEPC.ATEPCTrainer( config=config, dataset=dataset, from_checkpoint="English",# 不想基于预训练模型的话,删掉这行(还是建议用) auto_device=DeviceTypeOption.AUTO, # use cuda if available checkpoint_save_mode=ModelSaveOption.SAVE_MODEL_STATE_DICT, # save state dict only instead of the whole model load_aug=False, # there are some augmentation dataset for integrated datasets, you use them by setting load_aug=True to improve performance )
aspect_extractor = trainer.load_trained_model() assert isinstance(aspect_extractor, ATEPC.AspectExtractor)
Expected behavior I want to make small adjustments based on your own data Thank you for your answering!