zjowowen commited on
Commit
3836aeb
1 Parent(s): e71b23c

Upload policy_config.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. policy_config.py +106 -198
policy_config.py CHANGED
@@ -1,206 +1,114 @@
1
  exp_config = {
2
- 'env': {
3
- 'manager': {
4
- 'episode_num': float("inf"),
5
- 'max_retry': 5,
6
- 'step_timeout': None,
7
- 'auto_reset': True,
8
- 'reset_timeout': None,
9
- 'retry_type': 'reset',
10
- 'retry_waiting_time': 0.1,
11
- 'shared_memory': False,
12
- 'copy_on_get': True,
13
- 'context': 'fork',
14
- 'wait_num': float("inf"),
15
- 'step_wait_timeout': None,
16
- 'connect_timeout': 60,
17
- 'reset_inplace': False,
18
- 'cfg_type': 'SyncSubprocessEnvManagerDict',
19
- 'type': 'subprocess'
20
- },
21
- 'stop_value':
22
- 10000000000,
23
- 'n_evaluator_episode':
24
- 3,
25
- 'type':
26
- 'cartpole_lightzero',
27
- 'import_names':
28
- ['zoo.classic_control.cartpole.envs.cartpole_lightzero_env'],
29
- 'env_id':
30
- 'CartPole-v0',
31
- 'continuous':
32
- False,
33
- 'manually_discretization':
34
- False,
35
- 'replay_path':
36
- '/tmp/tmp4kdr3rf1/videos'
37
- },
38
- 'policy': {
39
- 'model': {
40
- 'model_type': 'mlp',
41
- 'continuous_action_space': False,
42
- 'observation_shape': 4,
43
- 'self_supervised_learning_loss': True,
44
- 'categorical_distribution': True,
45
- 'image_channel': 1,
46
- 'frame_stack_num': 1,
47
- 'num_res_blocks': 1,
48
- 'num_channels': 64,
49
- 'support_scale': 300,
50
- 'bias': True,
51
- 'discrete_action_encoding_type': 'one_hot',
52
- 'res_connection_in_dynamics': True,
53
- 'norm_type': 'BN',
54
- 'action_space_size': 2,
55
- 'lstm_hidden_size': 128,
56
- 'latent_state_dim': 128
57
- },
58
- 'learn': {
59
- 'learner': {
60
- 'train_iterations': 1000000000,
61
- 'dataloader': {
62
- 'num_workers': 0
63
- },
64
- 'log_policy': True,
65
- 'hook': {
66
- 'load_ckpt_before_run': '',
67
- 'log_show_after_iter': 100,
68
- 'save_ckpt_after_iter': 10000,
69
- 'save_ckpt_after_run': True
70
- },
71
- 'cfg_type': 'BaseLearnerDict'
72
- }
73
- },
74
- 'collect': {
75
- 'collector': {
76
- 'deepcopy_obs': False,
77
- 'transform_obs': False,
78
- 'collect_print_freq': 100,
79
- 'cfg_type': 'SampleSerialCollectorDict',
80
- 'type': 'sample'
81
- }
82
- },
83
- 'eval': {
84
- 'evaluator': {
85
- 'eval_freq': 1000,
86
- 'render': {
87
- 'render_freq': -1,
88
- 'mode': 'train_iter'
89
- },
90
- 'figure_path': None,
91
- 'cfg_type': 'InteractionSerialEvaluatorDict',
92
- 'stop_value': 10000000000,
93
- 'n_episode': 3
94
  }
95
  },
96
- 'other': {
97
- 'replay_buffer': {
98
- 'type': 'advanced',
99
- 'replay_buffer_size': 4096,
100
- 'max_use': float("inf"),
101
- 'max_staleness': float("inf"),
102
- 'alpha': 0.6,
103
- 'beta': 0.4,
104
- 'anneal_step': 100000,
105
- 'enable_track_used_data': False,
106
- 'deepcopy': False,
107
- 'thruput_controller': {
108
- 'push_sample_rate_limit': {
109
- 'max': float("inf"),
110
- 'min': 0
111
- },
112
- 'window_seconds': 30,
113
- 'sample_min_limit_ratio': 1
114
- },
115
- 'monitor': {
116
- 'sampled_data_attr': {
117
- 'average_range': 5,
118
- 'print_freq': 200
119
- },
120
- 'periodic_thruput': {
121
- 'seconds': 60
122
- }
123
- },
124
- 'cfg_type': 'AdvancedReplayBufferDict'
125
  },
126
- 'commander': {
127
- 'cfg_type': 'BaseSerialCommanderDict'
128
- }
129
- },
130
- 'on_policy': False,
131
- 'cuda': True,
132
- 'multi_gpu': False,
133
- 'bp_update_sync': True,
134
- 'traj_len_inf': False,
135
- 'use_rnd_model': False,
136
- 'sampled_algo': False,
137
- 'gumbel_algo': False,
138
- 'mcts_ctree': True,
139
- 'collector_env_num': 8,
140
- 'evaluator_env_num': 3,
141
- 'env_type': 'not_board_games',
142
- 'battle_mode': 'play_with_bot_mode',
143
- 'monitor_extra_statistics': True,
144
- 'game_segment_length': 50,
145
- 'transform2string': False,
146
- 'gray_scale': False,
147
- 'use_augmentation': False,
148
- 'augmentation': ['shift', 'intensity'],
149
- 'ignore_done': False,
150
- 'update_per_collect': 100,
151
- 'model_update_ratio': 0.1,
152
- 'batch_size': 256,
153
- 'optim_type': 'Adam',
154
- 'learning_rate': 0.003,
155
- 'target_update_freq': 100,
156
- 'target_update_freq_for_intrinsic_reward': 1000,
157
- 'weight_decay': 0.0001,
158
- 'momentum': 0.9,
159
- 'grad_clip_value': 10,
160
- 'n_episode': 8,
161
- 'num_simulations': 25,
162
- 'discount_factor': 0.997,
163
- 'td_steps': 5,
164
- 'num_unroll_steps': 5,
165
- 'reward_loss_weight': 1,
166
- 'value_loss_weight': 0.25,
167
- 'policy_loss_weight': 1,
168
- 'policy_entropy_loss_weight': 0,
169
- 'ssl_loss_weight': 2,
170
- 'lr_piecewise_constant_decay': False,
171
- 'threshold_training_steps_for_final_lr': 50000,
172
- 'manual_temperature_decay': False,
173
- 'threshold_training_steps_for_final_temperature': 100000,
174
- 'fixed_temperature_value': 0.25,
175
- 'use_ture_chance_label_in_chance_encoder': False,
176
- 'use_priority': True,
177
- 'priority_prob_alpha': 0.6,
178
- 'priority_prob_beta': 0.4,
179
- 'root_dirichlet_alpha': 0.3,
180
- 'root_noise_weight': 0.25,
181
- 'random_collect_episode_num': 0,
182
- 'eps': {
183
- 'eps_greedy_exploration_in_collect': False,
184
- 'type': 'linear',
185
- 'start': 1.0,
186
- 'end': 0.05,
187
- 'decay': 100000
188
  },
189
- 'cfg_type': 'MuZeroPolicyDict',
190
- 'type': 'muzero',
191
- 'import_names': ['lzero.policy.muzero'],
192
- 'reanalyze_ratio': 0,
193
- 'eval_freq': 200,
194
- 'replay_buffer_size': 1000000,
195
- 'device': 'cuda'
196
  },
197
- 'exp_name': 'CartPole-v0-MuZero',
198
- 'seed': 0,
199
- 'wandb_logger': {
200
- 'gradient_logger': False,
201
- 'video_logger': False,
202
- 'plot_logger': False,
203
- 'action_logger': False,
204
- 'return_logger': False
 
 
 
 
 
 
205
  }
206
  }
 
1
  exp_config = {
2
+ 'main_config': {
3
+ 'exp_name': 'CartPole-v0-MuZero',
4
+ 'seed': 0,
5
+ 'env': {
6
+ 'env_id': 'CartPole-v0',
7
+ 'continuous': False,
8
+ 'manually_discretization': False,
9
+ 'collector_env_num': 8,
10
+ 'evaluator_env_num': 3,
11
+ 'n_evaluator_episode': 3,
12
+ 'manager': {
13
+ 'shared_memory': False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
  },
16
+ 'policy': {
17
+ 'on_policy': False,
18
+ 'cuda': True,
19
+ 'multi_gpu': False,
20
+ 'bp_update_sync': True,
21
+ 'traj_len_inf': False,
22
+ 'model': {
23
+ 'observation_shape': 4,
24
+ 'action_space_size': 2,
25
+ 'model_type': 'mlp',
26
+ 'lstm_hidden_size': 128,
27
+ 'latent_state_dim': 128,
28
+ 'self_supervised_learning_loss': True,
29
+ 'discrete_action_encoding_type': 'one_hot',
30
+ 'norm_type': 'BN'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  },
32
+ 'use_rnd_model': False,
33
+ 'sampled_algo': False,
34
+ 'gumbel_algo': False,
35
+ 'mcts_ctree': True,
36
+ 'collector_env_num': 8,
37
+ 'evaluator_env_num': 3,
38
+ 'env_type': 'not_board_games',
39
+ 'battle_mode': 'play_with_bot_mode',
40
+ 'monitor_extra_statistics': True,
41
+ 'game_segment_length': 50,
42
+ 'transform2string': False,
43
+ 'gray_scale': False,
44
+ 'use_augmentation': False,
45
+ 'augmentation': ['shift', 'intensity'],
46
+ 'ignore_done': False,
47
+ 'update_per_collect': 100,
48
+ 'model_update_ratio': 0.1,
49
+ 'batch_size': 256,
50
+ 'optim_type': 'Adam',
51
+ 'learning_rate': 0.003,
52
+ 'target_update_freq': 100,
53
+ 'target_update_freq_for_intrinsic_reward': 1000,
54
+ 'weight_decay': 0.0001,
55
+ 'momentum': 0.9,
56
+ 'grad_clip_value': 10,
57
+ 'n_episode': 8,
58
+ 'num_simulations': 25,
59
+ 'discount_factor': 0.997,
60
+ 'td_steps': 5,
61
+ 'num_unroll_steps': 5,
62
+ 'reward_loss_weight': 1,
63
+ 'value_loss_weight': 0.25,
64
+ 'policy_loss_weight': 1,
65
+ 'policy_entropy_loss_weight': 0,
66
+ 'ssl_loss_weight': 2,
67
+ 'lr_piecewise_constant_decay': False,
68
+ 'threshold_training_steps_for_final_lr': 50000,
69
+ 'manual_temperature_decay': False,
70
+ 'threshold_training_steps_for_final_temperature': 100000,
71
+ 'fixed_temperature_value': 0.25,
72
+ 'use_ture_chance_label_in_chance_encoder': False,
73
+ 'use_priority': True,
74
+ 'priority_prob_alpha': 0.6,
75
+ 'priority_prob_beta': 0.4,
76
+ 'root_dirichlet_alpha': 0.3,
77
+ 'root_noise_weight': 0.25,
78
+ 'random_collect_episode_num': 0,
79
+ 'eps': {
80
+ 'eps_greedy_exploration_in_collect': False,
81
+ 'type': 'linear',
82
+ 'start': 1.0,
83
+ 'end': 0.05,
84
+ 'decay': 100000
85
+ },
86
+ 'cfg_type': 'MuZeroPolicyDict',
87
+ 'reanalyze_ratio': 0,
88
+ 'eval_freq': 200,
89
+ 'replay_buffer_size': 1000000
 
 
 
 
90
  },
91
+ 'wandb_logger': {
92
+ 'gradient_logger': False,
93
+ 'video_logger': False,
94
+ 'plot_logger': False,
95
+ 'action_logger': False,
96
+ 'return_logger': False
97
+ }
98
  },
99
+ 'create_config': {
100
+ 'env': {
101
+ 'type':
102
+ 'cartpole_lightzero',
103
+ 'import_names':
104
+ ['zoo.classic_control.cartpole.envs.cartpole_lightzero_env']
105
+ },
106
+ 'env_manager': {
107
+ 'type': 'subprocess'
108
+ },
109
+ 'policy': {
110
+ 'type': 'muzero',
111
+ 'import_names': ['lzero.policy.muzero']
112
+ }
113
  }
114
  }