class Root(ParamsProto, parse_args=False):
     """
     Root Configuration Object
     """
     env_name = Proto("FetchReach-v1", env="ENV_NAME",
                      help="this is a very long readme and it goes on and one and on and never stops. The line breaks have a large indent and it is not really clear how the indentation actually works. It almost looks like the paragraph is right aligned.")
     seed = Proto(123, help="this is short and longer")
     home = Proto('ge', env="USER", help="this is short and longer")
     some = Proto()
Exemple #2
0
    class G_2(ParamsProto):
        a = 23
        b = 29
        c = Proto(default=31, help="this is working")
        d = Proto(default=None, help="this is working")
        e = True

        @classmethod
        def __init__(cls, _deps=None):
            cls._update(_deps)
            cls.a = 2
            cls.b = 4
Exemple #3
0
    class CreateInstance(ParamsProto):
        """Example of using the Compute Engine API to create and delete instances.

        Creates a new compute engine instance and uses it to apply a caption to
        an image.

            https://cloud.google.com/compute/docs/tutorials/python-guide

        For more information, see the README.md under /compute.
        """
        project_id = Proto(env="JYNS_GCE_PROJECT",
                           help='Your Google Cloud project ID.')
        bucket_name = Proto(env="USER_GS_BUCKET",
                            help='Your Google Cloud Storage bucket name.')
        machine_type = Proto("n1-standard-1",
                             help="availability depends on region.")
        zone = Proto('us-central1-f', help='Compute Engine zone to deploy to.')
        instance_name = Proto('demo-instance', help='New instance name.')
Exemple #4
0
class Root(ParamsProto, cli_parse=False):
    """Root config object

    When multiple config objects are used, the first few
    being initiated need to have the `cli_parse` flag
    set to `False`.
    """
    launch_type = Proto(
        "borg",
        help="sdfa sdfas fasd fas dfas df asdf sa df sdf asd fas df asdf sa f "
        "asdf asdfas asdfasdfasdfasdf sdfa sdf asdf as dfas df asdf asdf"
        " sdfasfsadfa sdfas df asdf asfd asf")
def test_Proto_default():
    from params_proto.neo_proto import ParamsProto, Proto

    a = Proto(default=10)
    assert a.default == 10, "default should be correct"
    assert a.value == 10, "value should default to the original value"

    class Root(ParamsProto, cli=False, prefix="."):
        root_attribute = Proto(default=10)
        other_1 = Proto(20, "this is help text")

    print(vars(Root))
    assert vars(Root) == {'other_1': 20, 'root_attribute': 10}
    assert Root.root_attribute == 10
    assert Root().root_attribute == 10

    Root.root_attribute = 20
    assert Root.root_attribute == 20
    r = Root()
    r.root_attribute = 30
    assert r.root_attribute == 30
Exemple #6
0
 def set_hook(_, k, v, p=proto._prefix):
     # note: we wrap this value in Proto, so that we can distinguish
     #   between true None vs a None value set by the user.
     data[k] = Proto(v)
     return self.set_param(k, [v], prefix=p)
Exemple #7
0
 class G_2(ParamsProto):
     a = 23
     b = 29
     c = Proto(default=31, help="this is working")
     d = Proto(default=None, help="this is working")
     e = True
Exemple #8
0
 class G(ParamsProto):
     a = 23
     b = 29
     c = Proto(default=31, help="this is working")
     d = Proto(default=None, dtype=int, help="this is working")
Exemple #9
0
class Args(ParamsProto):
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    # environment
    domain = 'walker'
    task = 'walk'
    frame_stack = Proto(3, dtype=int)
    action_repeat = Proto(4, dtype=int)
    episode_length = Proto(1000, dtype=int)
    eval_mode = Proto('color_hard', dtype=str)

    # agent
    algo = Proto('sac', dtype=str)

    train_steps = Proto(500_000, dtype=int)
    discount = Proto(0.99, dtype=float)
    init_steps = Proto(1000, dtype=int)
    batch_size = Proto(128, dtype=int)
    hidden_dim = Proto(1024, dtype=int)

    # actor
    actor_lr = Proto(1e-3, dtype=float)
    actor_beta = Proto(0.9, dtype=float)
    actor_log_std_min = Proto(-10, dtype=float)
    actor_log_std_max = Proto(2, dtype=float)
    actor_update_freq = Proto(2, dtype=int)

    # critic
    critic_lr = Proto(1e-3, dtype=float)
    critic_beta = Proto(0.9, dtype=float)
    critic_tau = Proto(0.01, dtype=float)
    critic_target_update_freq = Proto(2, dtype=int)

    # architecture
    num_shared_layers = Proto(11, dtype=int)
    num_head_layers = Proto(0, dtype=int)
    num_filters = Proto(32, dtype=int)
    projection_dim = Proto(100, dtype=int)
    encoder_tau = Proto(0.05, dtype=float)

    # entropy maximization
    init_temperature = Proto(0.1, dtype=float)
    alpha_lr = Proto(1e-4, dtype=float)
    alpha_beta = Proto(0.5, dtype=float)

    # auxiliary tasks
    aux_lr = Proto(1e-3, dtype=float)
    aux_beta = Proto(0.9, dtype=float)
    aux_update_freq = Proto(2, dtype=int)

    # soda
    soda_batch_size = Proto(256, dtype=int)
    soda_tau = Proto(0.005, dtype=float)

    # eval
    eval_freq = Proto(10_000, dtype=int)
    eval_episodes = Proto(30, dtype=int)

    # checkpointing
    start_step = 0
    load_checkpoint = None
    save_freq = Proto(10_000,
                      dtype=int,
                      help="save frequency, in environment steps")
    save_last = True

    # misc
    seed = 100
    log_dir = 'logs'
    save_video = Flag(False)

    @classmethod
    def __init__(cls):
        assert cls.algo in {'sac', 'rad', 'curl', 'pad', 'soda'}, \
            f'specified algorithm "{cls.algo}" is not supported'

        assert cls.eval_mode in {
            'train', 'color_easy', 'color_hard', 'video_easy', 'video_hard'
        }, f'specified mode "{cls.eval_mode}" is not supported'
        assert cls.seed is not None, 'must provide seed for experiment'
        assert cls.log_dir is not None, 'must provide a log directory for experiment'
Exemple #10
0
 class Root(ParamsProto, cli=False, prefix="."):
     home = Proto(default='default', env="HOME")
     home_and_some = Proto(default='default', env="$HOME/and_some")
Exemple #11
0
 class Root(ParamsProto, cli=False, prefix="."):
     root_attribute = Proto(default=10)
     other_1 = Proto(20, "this is help text")