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,
    )
Example #2
0
    def wrapped(*args, **kwargs):
        import raylab

        raylab.register_all_agents()
        raylab.register_all_environments()

        return func(*args, **kwargs)
Example #3
0
def main():
    raylab.register_all_agents()
    raylab.register_all_environments()
    with suppress(KeyboardInterrupt):
        parser = create_parser()
        args = parser.parse_args()
        run(args, parser)
Example #4
0
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()
Example #5
0
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()
Example #6
0
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)
Example #7
0
def setup():
    ray.init(ignore_reinit_error=True)
    raylab.register_all_agents()
    raylab.register_all_environments()
Example #8
0
def main():
    raylab.register_all_agents()
    raylab.register_all_environments()
    parser = create_parser()
    args = parser.parse_args()
    run(args, parser)