Ejemplo n.º 1
0
def main():
    '''
    spinup.ppo(env_fn, actor_critic=<function mlp_actor_critic>, ac_kwargs={}, seed=0,
    steps_per_epoch=4000, epochs=50, gamma=0.99, clip_ratio=0.2, pi_lr=0.0003, vf_lr=0.001,
    train_pi_iters=80, train_v_iters=80, lam=0.97, max_ep_len=1000, target_kl=0.01, logger_kwargs={}, save_freq=10)
    '''
    parser = base_argparser()
    parser.add_argument("--pi_lr", type=float, default=0.0003)
    parser.add_argument("--vf_lr", type=float, default=0.001)
    parser.add_argument("--train_iters", type=int, default=80)
    parser.add_argument("--clip_ratio", type=float, default=0.2)
    parser.add_argument("--lam", type=float, default=0.97)
    parser.add_argument("--target_kl", type=float, default=0.01)
    args = parser.parse_args()
    # scale_hypers(args)

    args.start_steps = 0

    if args.test:
        test(args)
    else:
        if args.remote:
            name = '-'.join([*args.exp_name.split('_'), str(args.seed)])
            meta.call(
                backend=args.backend,
                fn=train,
                kwargs=dict(args=args),
                log_relpath=name,
                job_name=name,
                update=args.update,
                num_gpu=0,
            )
        else:
            train(args)
Ejemplo n.º 2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('backend')
    parser.add_argument('--cluster',
                        type=str,
                        default='ibis',
                        help='name of cluster')

    args = parser.parse_args()
    kwargs_dict = vars(args)

    if args.backend == 'interactive':
        run(**kwargs_dict)
    else:
        meta.call(
            backend='kube',
            cluster=args.cluster,
            fn=run,
            kwargs=kwargs_dict,
            job_name='cs231n-cifar10',
            log_relpath=f'hp-{datetime.now().strftime("%Y%m%d%H%M")}',
            num_cpu='1',
            num_gpu='8',
            mpi_machines=1,
            mpi_proc_per_machine='num_gpu',
        )
Ejemplo n.º 3
0
def main():
    '''
    spinup.sac(env_fn, actor_critic=<function mlp_actor_critic>, ac_kwargs={}, seed=0,
    steps_per_epoch=5000, epochs=100, replay_size=1000000, gamma=0.99, polyak=0.995,
    lr=0.001, alpha=0.2, batch_size=100, start_steps=10000, max_ep_len=1000, logger_kwargs={}, save_freq=1)
    '''
    parser = base_argparser()
    parser.add_argument("--polyak", type=float, default=0.995)
    parser.add_argument("--alpha", type=float, default=0.2)
    args = parser.parse_args()
    scale_hypers(args)

    if args.test:
        test(args)
    else:
        if args.remote:
            name = '-'.join([*args.exp_name.split('_')])
            meta.call(
                backend=args.backend,
                fn=train,
                kwargs=dict(args=args),
                log_relpath=name,
                job_name=name,
                update=args.update,
                num_gpu=0,
                num_cpu=args.ncpu,
            )
        else:
            train(args)
Ejemplo n.º 4
0
        #             log_relpath='atlas_%s' % datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%s'),
        #             num_cpu='auto',
        #             mpi_proc_per_machine=8,
        #             mpi_machines=1,
        #             num_gpu=8)
        for op_x in ["mixed3a", "mixed3b", "mixed4a", "mixed4b", "mixed4c", "mixed4d", "mixed5a", "mixed5b"]:
            for op_y in ["mixed3a", "mixed3b", "mixed4a", "mixed4b", "mixed4c", "mixed4d", "mixed5a", "mixed5b"]:
                import json
                import hashlib
                ops = [op_x, op_y]
                identifier = hashlib.md5(json.dumps((model, ops)).encode('utf-8')).hexdigest()
                meta.call(
                    backend=args.backend,
                    fn=run,
                    args = [ identifier ],
                    log_relpath='atlas_%s' % datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%s'),
                    num_cpu='auto',
                    mpi_proc_per_machine=8,
                    mpi_machines=1,
                    num_gpu=8)


# D = load("gs://clarity-public/ggoh/diff/temp1/means.json")

# coordinates = D['coordinates']

# canvas = np.ones((40*A.shape[1], 40*A.shape[1],3))
# A = load("gs://clarity-public/ggoh/diff/temp1/ry.npy")

# def slice_xy(x,y,img):
#     s = A.shape[1]
Ejemplo n.º 5
0
    #                 log_relpath='atlas_%s' % datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%s'),
    #                 num_cpu='auto',
    #                 mpi_proc_per_machine=1,
    #                 mpi_machines=1,
    #                 num_gpu=1)

    model = ("InceptionV1", "InceptionV1")

    if args.backend == "interactive":
        ops = ("mixed3a", "mixed4c")
        run(model, ops)
    else:
        for op_x in [
                "mixed3a", "mixed3b", "mixed4a", "mixed4b", "mixed4c",
                "mixed4d", "mixed5a", "mixed5b", "head0_bottleneck",
                "head1_bottleneck"
        ]:
            for op_y in [
                    "mixed3a", "mixed3b", "mixed4a", "mixed4b", "mixed4c",
                    "mixed4d", "mixed5a", "mixed5b", "head0_bottleneck",
                    "head1_bottleneck"
            ]:
                meta.call(
                    backend=args.backend,
                    fn=run,
                    args=[model, [op_x, op_y]],
                    log_relpath='atlas_%s' %
                    datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%s'),
                    num_cpu='auto',
                    num_gpu=1)