plt.plot(r) plt.pause(0.001) # pause a bit so that plots are updated if is_ipython: display.clear_output(wait=True) display.display(plt.gcf()) if __name__ == '__main__': monitor_macddpg_p2 = [] monitor_macddpg_p2_test = [] for i in range(0,5): config = get_params(args=['--exp_id','MACDDPG_P2_120K_'+ str(i+1), '--random_seed', str(i+1), '--agent_alg', 'MACDDPG', '--protocol_type', str(2), '--n_episodes', '120000', '--verbose', '2', ] ) model, experiment_args = init(config) env, memory, ounoise, config, summaries, saver, start_episode = experiment_args tic = time.time() monitor = run(model, experiment_args, train=True) monitor_test = run(model, experiment_args, train=False) toc = time.time() env.close() for summary in summaries:
if exp_config['obj_rew'] == 'True': ####################### loading object ########################### model_name = 'DDPG_BD' exp_args = [ '--env_id', env_name, '--exp_id', model_name + '_fooobj_' + str(0), '--random_seed', str(0), '--agent_alg', model_name, '--verbose', '2', '--render', '0', '--gamma', '0.99', '--n_episodes', '50', '--n_cycles', '50', '--n_rollouts', '38', '--n_test_rollouts', '38', '--n_envs', '1', '--n_batches', '40', '--batch_size', '4864', '--obj_action_type', '0123456', '--max_nb_objects', '1', '--observe_obj_grp', 'False', '--rob_policy', '01' ] config = get_params(args=exp_args) model, experiment_args = init(config, agent='object', her=True, object_Qfunc=None, backward_dyn=None, object_policy=None) env, memory, noise, config, normalizer, agent_id = experiment_args #loading the object model if env_name == 'HandManipulateEggRotateMulti-v0': path = './models_paper/obj/egg_rotate_7d_50ep/' elif env_name == 'HandManipulateBlockRotateXYZMulti-v0': path = './models_paper/obj/block_rotate_7d_50ep/' elif env_name == 'HandManipulatePenRotateMulti-v0': path = './models_paper/obj/pen_rotate_7d_50ep/'
int(exp_config['n_exp'])): if exp_config['obj_rew'] == 'True': ####################### loading object ########################### exp_args_0 = [ '--env_id', env_name_0[i_env], '--exp_id', model_name + '_fooobj_' + str(0), '--random_seed', str(0), '--agent_alg', model_name, '--verbose', '2', '--render', '0', '--gamma', '0.99', '--n_episodes', '50', '--n_cycles', '50', '--n_rollouts', '38', '--n_test_rollouts', '38', '--n_envs', '1', '--n_batches', '40', '--batch_size', '4864', '--obj_action_type', '0123456', '--max_nb_objects', '1', '--observe_obj_grp', 'False', '--rob_policy', '01' ] config_0 = get_params(args=exp_args_0) model_0, experiment_args_0 = init(config_0, agent='object', her=True, object_Qfunc=None, backward_dyn=None, object_policy=None) env_0, memory_0, noise_0, config_0, normalizer_0, agent_id_0 = experiment_args_0 #loading the object model if ENV == 'Egg': path = './models_paper/obj/egg_rotate_7d_50ep/' elif ENV == 'Block': path = './models_paper/obj/block_rotate_7d_50ep/' elif ENV == 'Pen': path = './models_paper/obj/pen_rotate_7d_50ep/'