plugins.base
Base class for all plugins.
Plugin Objects#
Base class for all plugins.
It is structured around three core components
[trn.Trainer, module_interface.ModuleInterface, data_interface.DataInterface].
Derived classes should implement the methods setup_data,
setup_module, and setup. These methods will execute the data processing
pipeline and initialize the required components for training such as
trainer and module_interface. setup_trainer initializes the PyMarlin
trainer and backend.
plugin.setup is provided to bootstrap the entire pipeline for a specific
downstream task.
Example::
trainer = plugin.setup() trainer.train() trainer.validate()
__init__#
CustomArgParser parses YAML config located at cmdline --config_path. If --config_path is not provided, assumes YAML file is named config.yaml and present in working directory. self.trainer_args (trn.TrainerArguments): Instantiated dataclass containing args required to initialize trn.Trainer class.
datainterface#
DataInterface object used for data processing.
The property can be set in setup_datainterface.
Returns:
An object of type data_interface.DataInterface.
dataprocessor#
DataProcessor object(s) used for data processing.
The property may be used in conjuction with datainterface in the
setup_datainterface method.
Returns:
An object of type data_interface.DataProcessor.
moduleinterface#
ModuleInterface object.
The property can be set in setup_module.
Returns:
An object of type module_interface.ModuleInterface.
trainer#
Trainer object.
The property can be set in setup_trainer.
Returns:
An object of type trn.Trainer.
setup_datainterface#
Derived plugins must implement this method. The method should execute a generic data processing pipeline for the task and update the TaskDataInterface object to contain the processed train and val datasets.
NOTE to TaskPlugin designers: Typically, the plugin shouldn't need any input arguments from user except from the YAML config. DataInterface and DataProcessor related arguments should be processed in the init method of the TaskPlugin.
Returns:
datainterface_objdata_interface.DataInterface - TaskDataInterface object
setup_module#
Derived plugins must implement this method. The method should
create a TaskModuleInterface object (module_interface.ModuleInterface)
and set moduleinterface property.
NOTE to TaskPlugin designers: Typically, the plugin shouldn't need any input arguments from user. ModuleInterface related arguments should be processed in the init method of the TaskPlugin.
setup_trainer#
Creates a trn.Trainer object and sets the trainer property.
Used by all plugins unless overriden (not recommended).
setup#
Executes all steps from data processing to trainer initialization.
This should be equivalent to::