def setup(self, load=None, load_state_dict=None, save_every=None, train_dir=None, report_every=50):
    expect((not ((load is not None) and (load_state_dict is not None))), '`load` and `load_state_dict` cannot be passed simultaneously.')
    if (load is not None):
        self.load(load)
    else:
        assert (self.model is not None)
        if (load_state_dict is not None):
            self._load_state_dict(load_state_dict)
    self.logger.info('param size = {} M'.format((utils.count_parameters(self.model, count_binary=isinstance(self.model, BNNGenotypeModel)) / 1000000.0)))
    if (self.model is not None):
        self._parallelize()
        self.optimizer = self._init_optimizer()
        self.scheduler = self._init_scheduler(self.optimizer, self.optimizer_scheduler_cfg)
    self.save_every = save_every
    self.train_dir = train_dir
    self.report_every = report_every
    expect(((self.save_every is None) or (self.train_dir is not None)), 'when `save_every` is not None, make sure `train_dir` is not None')
    self._is_setup = True
def setup(self, load=None, load_state_dict=None, save_every=None, train_dir=None, report_every=50):
    expect((not ((load is not None) and (load_state_dict is not None))), '`load` and `load_state_dict` cannot be passed simultaneously.')
    if (load is not None):
        self.load(load)
    else:
        assert (self.model is not None)
        if (load_state_dict is not None):
            self._load_state_dict(load_state_dict)
    self.logger.info('param size = {} M'.format((utils.count_parameters(self.model, count_binary=isinstance(self.model, BNNGenotypeModel)) / 1000000.0)))
    if (self.model is not None):
        self._parallelize()
        self.optimizer = self._init_optimizer()
        self.scheduler = self._init_scheduler(self.optimizer, self.optimizer_scheduler_cfg)
    self.save_every = save_every
    self.train_dir = train_dir
    self.report_every = report_every
    expect(((self.save_every is None) or (self.train_dir is not None)), 'when `save_every` is not None, make sure `train_dir` is not None')
    self._is_setup = True