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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
}
|