def model(self): if self._wrapped_model is None: if self.args['distributed_training']['distributed_world_size'] > 1 and \ not self.args['optimization']['use_bmuf']: self._wrapped_model = models.DistributedNccModel(self.args, self._model) else: self._wrapped_model = self._model return self._wrapped_model
def criterion(self): if self._wrapped_criterion is None: if (utils.has_parameters(self._criterion) and self.args['distributed_training']['distributed_world_size'] > 1 and not self.args['optimization']['use_bmuf']): self._wrapped_criterion = models.DistributedNccModel( self.args, self._criterion) else: self._wrapped_criterion = self._criterion return self._wrapped_criterion