def load_model(self): from reversi_zero.agent.model import ReversiModel model = ReversiModel(self.config) if self.config.opts.new or not load_best_model_weight(model): model.build() save_as_best_model(model) return model
def start(self): self.best_model = self.load_best_model() while True: ng_model, model_dir = self.load_next_generation_model() logger.debug(f"start evaluate model {model_dir}") ng_is_great = self.evaluate_model(ng_model) if ng_is_great: logger.debug(f"New Model become best model: {model_dir}") save_as_best_model(ng_model) self.best_model = ng_model self.remove_model(model_dir)
def load_model(self): from reversi_zero.agent.model import ReversiModel model = ReversiModel(self.config) loaded = False if not self.config.opts.new: if self.config.play.use_newest_next_generation_model: loaded = reload_newest_next_generation_model_if_changed(model) or load_best_model_weight(model) else: loaded = load_best_model_weight(model) or reload_newest_next_generation_model_if_changed(model) if not loaded: model.build() save_as_best_model(model) return model