pyabsa.framework.trainer_class.trainer_template

Module Contents

Classes

Trainer

Trainer class for training PyABSA models

Functions

init_config(config)

pyabsa.framework.trainer_class.trainer_template.init_config(config)[source]
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)[source]

Trainer class for training PyABSA models

_run()[source]

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

load_trained_model()[source]

Load trained model for inference

Returns:

Inference model for the trained model.

destroy()[source]

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