def _build_model(self): """ Build the crucial components for model training """ if self.is_loadmodel is False: _config = { 'input_size': 768, 'layer_hidden_sizes': self.layer_hidden_sizes, 'num_layers': self.num_layers, 'bias': self.bias, 'dropout': self.dropout, 'bidirectional': self.bidirectional, 'batch_first': self.batch_first, 'label_size': self.label_size } self.predictor = callPredictor(**_config).to(self.device) self._save_predictor_config(_config) if self.dataparallal: self.predictor = torch.nn.DataParallel(self.predictor) self.criterion = callLoss(task=self.task_type, loss_name=self.loss_name, aggregate=self.aggregate) self.optimizer = self._get_optimizer(self.optimizer_name)
def _build_model(self): """ Build the crucial components for model training """ if self.is_loadmodel is False: _config = { 'input_channel': 768, 'nhid': self.nhid, 'n_level': self.n_level, 'kernel_size': self.kernel_size, 'hidden_size': self.hidden_size, 'label_size': self.label_size } self.predictor = callPredictor(**_config).to(self.device) self._save_predictor_config(_config) if self.dataparallal: self.predictor = torch.nn.DataParallel(self.predictor) self.criterion = callLoss(task=self.task_type, loss_name=self.loss_name, aggregate=self.aggregate) self.optimizer = self._get_optimizer(self.optimizer_name)