Ejemplo n.º 1
0
            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/'

            print('loading object model for rotation')
            print(path)
            model_0.critics[0].load_state_dict(K.load(path +
Ejemplo n.º 2
0
            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/'

            print('loading object model')
            print(path)
            model.critics[0].load_state_dict(K.load(path + 'object_Qfunc.pt'))
Ejemplo n.º 3
0
            '--n_bd_batches',
            '400',
            '--obj_action_type',
            '012',
            '--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 exp_config['env'] == 'Push':
            path = './models/obj/obj_push_xyz/'
        elif exp_config['env'] == 'PnP':
            path = './models/obj/obj_pnp_xyz/'

        model.critics[0].load_state_dict(K.load(path + 'object_Qfunc.pt'))
        model.backward.load_state_dict(K.load(path + 'backward_dyn.pt'))
        model.actors[0].load_state_dict(K.load(path + 'object_policy.pt'))
        with open(path + 'normalizer.pkl', 'rb') as file:
            normalizer = pickle.load(file)