Ejemplo n.º 1
0
 def load_model(self):
     from agent.model_connect4 import Connect4Model
     model = Connect4Model(self.config)
     if self.config.opts.new or not load_best_model_weight(model):
         model.build()
         save_as_best_model(model)
     return model
Ejemplo n.º 2
0
    def load_model(self):
        from agent.model_connect4 import Connect4Model
        model = Connect4Model(self.config)
        rc = self.config.resource

        dirs = get_next_generation_model_dirs(rc)
        if not dirs:
            logger.debug(f"loading best model")
            if not load_best_model_weight(model):
                raise RuntimeError(f"Best model can not loaded!")
        else:
            latest_dir = dirs[-1]
            logger.debug(f"loading latest model")
            config_path = os.path.join(
                latest_dir, rc.next_generation_model_config_filename)
            weight_path = os.path.join(
                latest_dir, rc.next_generation_model_weight_filename)
            model.load(config_path, weight_path)
        return model
Ejemplo n.º 3
0
 def load_best_model(self):
     model = GameModel(self.config)
     load_best_model_weight(model)
     return model
Ejemplo n.º 4
0
 def _load_model(self):
     from agent.model import GameModel
     model = GameModel(self.config)
     if not load_best_model_weight(model):
         print("best model not found!")
     return model
Ejemplo n.º 5
0
 def _load_model(self):
     from agent.model_connect4 import Connect4Model
     model = Connect4Model(self.config)
     if not load_best_model_weight(model):
         raise RuntimeError("best model not found!")
     return model
Ejemplo n.º 6
0
 def load_best_model(self):
     model = Connect4Model(self.config)
     load_best_model_weight(model)
     return model