pyabsa.framework.trainer_class.trainer_template

Classes

Trainer

Trainer class for training PyABSA models

Functions

init_config(config)

Module Contents

pyabsa.framework.trainer_class.trainer_template.init_config(config)
class pyabsa.framework.trainer_class.trainer_template.Trainer(config: pyabsa.framework.configuration_class.configuration_template.ConfigManager = None, dataset: pyabsa.utils.data_utils.dataset_item.DatasetItem | pathlib.Path | str | pyabsa.framework.dataset_class.dataset_dict_class.DatasetDict = None, from_checkpoint: pathlib.Path | str = None, checkpoint_save_mode: pyabsa.framework.flag_class.flag_template.ModelSaveOption | int = ModelSaveOption.SAVE_MODEL_STATE_DICT, auto_device: str | bool = DeviceTypeOption.AUTO, path_to_save: pathlib.Path | str = None, load_aug=False)

Trainer class for training PyABSA models

config = None
training_instructor = None
inference_model_class = None
inference_model = None
_run()

just return the trained model for inference (e.g., polarity classification, aspect-term extraction)

load_trained_model()

Load trained model for inference

Returns:

Inference model for the trained model.

destroy()

Clear the inference model from memory and empty the CUDA cache.