capreolus.trainer

Package Contents

Classes

Trainer Base class for Trainer modules. The purpose of a Trainer is to train a Reranker module and use it to make predictions. Capreolus provides two trainers: PytorchTrainer and TensorFlowTrainer
capreolus.trainer.logger[source]
class capreolus.trainer.Trainer(config=None, provide=None, share_dependency_objects=False, build=True)[source]

Bases: capreolus.ModuleBase

Base class for Trainer modules. The purpose of a Trainer is to train a Reranker module and use it to make predictions. Capreolus provides two trainers: PytorchTrainer and TensorFlowTrainer

Modules should provide:
  • a train method that trains a reranker on training and dev (validation) data
  • a predict method that uses a reranker to make predictions on data
module_type = trainer[source]
requires_random_seed = True[source]
get_paths_for_early_stopping(self, train_output_path, dev_output_path)[source]
change_lr(self, epoch, lr)[source]

Apply warm up or decay depending on the current epoch

lr_multiplier(self, epoch)[source]