def start(): parser = create_parser() args = parser.parse_args() config_type = args.type config = Config(config_type=config_type) setup(config, args) logger.info('Config type: %s' % (config_type)) if args.cmd == 'self': from cchess_alphazero.worker import self_play config.opts.light = True # use lighten environment return self_play.start(config) elif args.cmd == 'self2': from cchess_alphazero.worker import self_play2 config.opts.light = True # use lighten environment return self_play2.start(config) elif args.cmd == 'opt': from cchess_alphazero.worker import optimize return optimize.start(config) elif args.cmd == 'play': from cchess_alphazero.play_games import play config.opts.light = False pwhc = PlayWithHumanConfig() pwhc.update_play_config(config.play) logger.info(f"AI move first : {args.ai_move_first}") play.start(config, not args.ai_move_first)
def start(): parser = create_parser() args = parser.parse_args() config_type = args.type config = Config(config_type=config_type) setup(config, args) logger.info('Config type: %s' % (config_type)) config.opts.piece_style = args.piece_style config.opts.bg_style = args.bg_style config.internet.distributed = args.distributed if args.cmd == 'self': if args.ucci: import cchess_alphazero.worker.play_with_ucci_engine as self_play else: if mp.get_start_method() == 'spawn': import cchess_alphazero.worker.self_play_windows as self_play else: from cchess_alphazero.worker import self_play return self_play.start(config) elif args.cmd == 'opt': from cchess_alphazero.worker import optimize return optimize.start(config) elif args.cmd == 'play': if args.cli: import cchess_alphazero.play_games.play_cli as play else: from cchess_alphazero.play_games import play config.opts.light = False pwhc = PlayWithHumanConfig() pwhc.update_play_config(config.play) logger.info(f"AI move first : {args.ai_move_first}") play.start(config, not args.ai_move_first) elif args.cmd == 'eval': if args.elo == False: from cchess_alphazero.worker import evaluator else: import cchess_alphazero.worker.compute_elo as evaluator config.eval.update_play_config(config.play) evaluator.start(config) elif args.cmd == 'sl': if args.onegreen: import cchess_alphazero.worker.sl_onegreen as sl sl.start(config, args.skip) else: from cchess_alphazero.worker import sl sl.start(config) elif args.cmd == 'ob': from cchess_alphazero.play_games import ob_self_play pwhc = PlayWithHumanConfig() pwhc.update_play_config(config.play) ob_self_play.start(config, args.ucci, args.ai_move_first)
def start(): parser = create_parser() args = parser.parse_args() config_type = args.type config = Config(config_type=config_type) setup(config, args) logger.info('Config type: %s' % (config_type)) config.opts.piece_style = args.piece_style config.opts.bg_style = args.bg_style config.internet.distributed = args.distributed # # use multiple GPU gpus = torch.cuda.device_count() if gpus > 1: config.opts.use_multiple_gpus = True config.opts.gpu_num = gpus config.opts.use_gpu = True # logger.info(f"User GPU {config.opts.device_list}") elif gpus == 1: config.opts.use_gpu = True if args.cmd == 'self': # if args.ucci: # import cchess_alphazero.worker.play_with_ucci_engine as self_play # else: # if mp.get_start_method() == 'spawn': # import cchess_alphazero.worker.self_play_windows as self_play # else: # from cchess_alphazero.worker import self_play import cchess_alphazero.worker.self_play_windows as self_play return self_play.start(config) elif args.cmd == 'opt': from cchess_alphazero.worker import optimize return optimize.start(config) elif args.cmd == 'play': if args.cli: import cchess_alphazero.play_games.play_cli as play else: from cchess_alphazero.play_games import play config.opts.light = False pwhc = PlayWithHumanConfig() pwhc.update_play_config(config.play) logger.info(f"AI move first : {args.ai_move_first}") play.start(config, not args.ai_move_first) elif args.cmd == 'pk': import cchess_alphazero.worker.pk_player_windows as self_play return self_play.start(config)