peal.training.trainers.get_predictor

peal.training.trainers.get_predictor(config, model=None)[source]

Instantiate the predictor described by a PredictorConfig.

Input channels come from task.x_selection (non-image data) or data.input_size; output channels from task.output_channels or data.output_size. config.architecture may be an ArchitectureConfig (-> SequentialModel), a torchvision_<name> string (-> TorchvisionModel) or a .cpl path to a pickled module.

Parameters:
  • config (PredictorConfig) – Config with task, data, architecture and training.

  • model (torch.nn.Module, optional) – When given it is returned unchanged.

Returns:

The predictor.

Return type:

torch.nn.Module

Raises:

Exception – When config.architecture matches none of the supported forms.