File size: 2,357 Bytes
079c32c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from easydict import EasyDict

cartpole_ppg_config = dict(
    exp_name='cartpole_ppg_seed0',
    env=dict(
        collector_env_num=8,
        evaluator_env_num=5,
        n_evaluator_episode=5,
        stop_value=195,
    ),
    policy=dict(
        cuda=False,
        model=dict(
            obs_shape=4,
            action_shape=2,
            encoder_hidden_size_list=[64, 64, 128],
            critic_head_hidden_size=128,
            actor_head_hidden_size=128,
        ),
        learn=dict(
            update_per_collect=5,
            batch_size=64,
            learning_rate=0.001,
            value_weight=0.5,
            entropy_weight=0.01,
            clip_ratio=0.2,
        ),
        collect=dict(
            n_sample=128,
            unroll_len=1,
            discount_factor=0.9,
            gae_lambda=0.95,
        ),
        eval=dict(evaluator=dict(eval_freq=40, )),
        other=dict(
            replay_buffer=dict(
                multi_buffer=True,
                policy=dict(
                    replay_buffer_size=100,
                    max_use=10,
                ),
                value=dict(
                    replay_buffer_size=1000,
                    max_use=100,
                ),
            ),
        ),
    ),
)
cartpole_ppg_config = EasyDict(cartpole_ppg_config)
main_config = cartpole_ppg_config
cartpole_ppg_create_config = dict(
    env=dict(
        type='cartpole',
        import_names=['dizoo.classic_control.cartpole.envs.cartpole_env'],
    ),
    env_manager=dict(type='base'),
    policy=dict(type='ppg_offpolicy'),
    replay_buffer=dict(
        policy=dict(type='advanced'),
        value=dict(type='advanced'),
    )
)
cartpole_ppg_create_config = EasyDict(cartpole_ppg_create_config)
create_config = cartpole_ppg_create_config

if __name__ == "__main__":
    # This config file can be executed by `dizoo/classic_control/cartpole/entry/cartpole_ppg_main.py`
    import os
    import warnings
    from dizoo.classic_control.cartpole.entry.cartpole_ppg_main import main
    from dizoo.classic_control.cartpole.entry.cartpole_ppg_main import __file__ as _origin_py_file
    origin_py_file_rel = os.path.relpath(_origin_py_file, os.path.abspath(os.path.curdir))
    warnings.warn(UserWarning(f"This config file can be executed by {repr(origin_py_file_rel)}"))
    main(cartpole_ppg_config)