pyabsa.tasks.AspectSentimentTripletExtraction.instructor.instructor

Classes

ASTETrainingInstructor

Module Contents

class pyabsa.tasks.AspectSentimentTripletExtraction.instructor.instructor.ASTETrainingInstructor(config)

Bases: pyabsa.framework.instructor_class.instructor_template.BaseTrainingInstructor

_load_dataset_and_prepare_dataloader()

Load the dataset and prepare the dataloader. This method should be implemented in a subclass.

_prepare_dataloader()

Prepares the data loaders for training, validation, and testing. Special for ASTE, do not use the default data loader

_train_and_evaluate(criterion)

Train and evaluate the model. This method should be implemented in a subclass.

_k_fold_train_and_evaluate(criterion)

Train and evaluate the model using k-fold cross validation. This method should be implemented in a subclass.

_evaluate_f1(data_loader, FLAG=False)
_init_misc()

Initialize miscellaneous settings specific to the subclass implementation. This method should be implemented in a subclass.

run()
_train(criterion)

Train the model on a given criterion.

Parameters:

criterion – The loss function used to train the model.

Returns:

If there is only one validation dataloader, return the training results. If there are more than one validation dataloaders, perform k-fold cross-validation and return the results.