コード例 #1
0
ファイル: game.py プロジェクト: mattroz/ELF
    def __init__(self):
        self.context_params = ContextParams()

        self.args = ArgsProvider(define_params=[
            ("handicap_level", 0), ("latest_start", 1000),
            ("latest_start_decay", 0.7), ("fs_ai", 50), ("fs_opponent", 50),
            ("ai_type",
             dict(type=str,
                  choices=[
                      "AI_SIMPLE", "AI_HIT_AND_RUN", "AI_NN", "AI_FLAG_NN",
                      "AI_TD_NN"
                  ],
                  default="AI_NN")),
            ("opponent_type",
             dict(type=str,
                  choices=[
                      "AI_SIMPLE", "AI_HIT_AND_RUN", "AI_FLAG_SIMPLE",
                      "AI_TD_BUILT_IN"
                  ],
                  default="AI_SIMPLE")),
            ("max_tick", dict(type=int, default=30000, help="Maximal tick")),
            ("mcts_threads", 64), ("seed", 0), ("simple_ratio", -1),
            ("ratio_change", 0), ("actor_only", dict(action="store_true"))
        ],
                                 more_params=["batchsize", "T"],
                                 child_providers=[self.context_params.args])
コード例 #2
0
 def __init__(self):
     self.args = ArgsProvider(call_from=self,
                              define_params=[
                                  ("num_minibatch", 5000),
                                  ("num_episode", 10000),
                                  ("tqdm", dict(action="store_true")),
                              ])
コード例 #3
0
ファイル: run.py プロジェクト: zgsxwsdxg/ELF
 def __init__(self):
     self.args = ArgsProvider(
         call_from = self,
         define_params = [
             ("stats", dict(type=str, choices=["rewards", "winrate"], default="rewards")),
             ("num_eval", 500)
         ]
     )
コード例 #4
0
 def __init__(self):
     super(EvaluationProcess, self).__init__()
     self.server = ParameterServer(2)
     self.args = ArgsProvider(call_from=self,
                              define_params=[
                                  ("eval_freq", 10),
                                  ("eval_gpu", 1),
                              ])
     self.count = 0
コード例 #5
0
 def __init__(self):
     self.args = ArgsProvider(
         call_from=self,
         define_args=[("num_games", 1024), ("batchsize", 128),
                      ("game_multi", dict(type=int, default=None)),
                      ("T", 6), ("eval", dict(action="store_true")),
                      ("wait_per_group", dict(action="store_true")),
                      ("verbose_comm", dict(action="store_true")),
                      ("verbose_collector", dict(action="store_true"))],
         on_get_args=self._on_get_args)
コード例 #6
0
 def __init__(self, model_class):
     self.model_class = model_class
     self.args = ArgsProvider(call_from=self,
                              define_params=[("gpu",
                                              dict(type=str,
                                                   help="gpu to use",
                                                   default=None)),
                                             ("load",
                                              dict(type=str,
                                                   help="load model",
                                                   default=None))])
コード例 #7
0
    def __init__(self):
        self.context_args = ContextArgs()

        self.args = ArgsProvider(call_from=self,
                                 define_args=[
                                     ("frame_skip", 4), ("hist_len", 4),
                                     ("rom_file", "pong.bin"),
                                     ("actor_only", dict(action="store_true")),
                                     ("reward_clip", 1),
                                     ("rom_dir", os.path.dirname(__file__))
                                 ],
                                 more_args=["batchsize", "T"],
                                 child_providers=[self.context_args.args])
コード例 #8
0
 def __init__(self):
     self.timer = RLTimer()
     self.last_time = None
     self.args = ArgsProvider(
         call_from=self,
         define_params=[
             ("freq_update", 1),
             ("record_dir", "./record"),
             ("save_prefix", "save"),
             ("save_dir", dict(type=str, default=None)),
         ],
         more_params=["num_games", "batchsize", "num_minibatch"],
         on_get_params=self._on_get_params)
コード例 #9
0
    def __init__(self, mi=None, args=None):
        if args is None:
            self.args = ArgsProvider(call_from=self,
                                     define_params=self._params(),
                                     on_get_params=self._init)
        else:
            self.args = args
            self._init(args)

        # Accumulated errors.
        self.stats = defaultdict(lambda: Stats())

        self._cb = {}
        if mi is not None:
            self.model_interface = mi
コード例 #10
0
 def __init__(self):
     self.args = ArgsProvider(
         call_from=self,
         define_params=[
             ("sample_policy",
              dict(type=str,
                   choices=["epsilon-greedy", "multinomial", "uniform"],
                   help="Sample policy",
                   default="epsilon-greedy")),
             ("sample_node", dict(type=str, default="pi")),
             ("greedy", dict(action="store_true")),
             ("epsilon",
              dict(type=float,
                   help="Used in epsilon-greedy approach",
                   default=0.00))
         ])