def configure_optimizers(self): opt_args = dict(self.config.optimizer.params) opt_args.update({"params": self.model.parameters()}) opt = load_class(module=optim, name=self.config.optimizer.type, args=opt_args) scheduler_args = dict(self.config.scheduler.params) scheduler_args.update({"optimizer": opt}) scheduler = load_class( module=optim.lr_scheduler, name=self.config.scheduler.type, args=scheduler_args, ) result = {"optimizer": opt, "lr_scheduler": scheduler} if self.config.scheduler.params == "ReduceLROnPlateau": result.update({"monitor": self.config.scheduler.monitor}) return result
def build_model(model_conf: DictConfig): return load_class(module=Net, name=model_conf.type, args={"model_config": model_conf})
def _build_output_layer(output_layer_config): return load_class(module=nn, name=output_layer_config["type"], args=output_layer_config["args"])