def main(ctx, **args): """Launch IBExplorationAgent.""" if not osp.exists(args["local_dir"]) and click.confirm( "Provided `local_dir` does not exist. Create it?"): os.makedirs(args["local_dir"]) click.echo("Created directory {}".format(args["local_dir"])) exp_dir = osp.join(args["local_dir"], args["name"]) if osp.exists(exp_dir) and not click.confirm( f"Experiment directory {exp_dir} already exists. Proceed anyway?"): ctx.exit() raylab.register_all_environments() raylab.register_all_agents() ray.init() logging.getLogger("ray.tune").setLevel(args["tune_log_level"]) tune.run( IBExplorationAgent, name=args["name"], local_dir=args["local_dir"], num_samples=args["num_samples"], stop={k: v for k, v in args["stop"]}, config=CONFIG, checkpoint_freq=args["checkpoint_freq"], checkpoint_at_end=args["checkpoint_at_end"], loggers=CUSTOM_LOGGERS if args["custom_loggers"] else None, )
def wrapped(*args, **kwargs): import raylab raylab.register_all_agents() raylab.register_all_environments() return func(*args, **kwargs)
def main(): raylab.register_all_agents() raylab.register_all_environments() with suppress(KeyboardInterrupt): parser = create_parser() args = parser.parse_args() run(args, parser)
def register_envs(): import raylab from raylab.envs.registry import ENVS def _mock_env_maker(config): return MockEnv(config) ENVS["MockEnv"] = _mock_env_maker raylab.register_all_environments()
def envs(): from raylab.envs.registry import ENVS # pylint:disable=import-outside-toplevel def _mock_env_maker(config): return MockEnv(config) ENVS["MockEnv"] = _mock_env_maker raylab.register_all_environments() return ENVS.copy()
def register_envs(): import raylab import raylab.envs as envs import lqsvg lqsvg.register_all_environments() raylab.register_all_environments() # pylint:disable=unnecessary-lambda envs.register_env("MockEnv", lambda c: MockEnv(c)) envs.register_reward_fn("MockEnv")(MockReward) envs.register_termination_fn("MockEnv")(MockTermination)
def setup(): ray.init(ignore_reinit_error=True) raylab.register_all_agents() raylab.register_all_environments()
def main(): raylab.register_all_agents() raylab.register_all_environments() parser = create_parser() args = parser.parse_args() run(args, parser)