openai / baselines

OpenAI Baselines: high-quality implementations of reinforcement learning algorithms
MIT License
15.82k stars 4.88k forks source link

How to use evaluate mode of GAIL? #1049

Open Weiyi-Zhang258 opened 4 years ago

Weiyi-Zhang258 commented 4 years ago

I've finished training and get a model like this: image When I set the args like this: parser.add_argument('--load_model_path', help='if provided, load the model', type=str, default='G:/Anaconda/envs/zwy/Lib/site-packages/baselines-master/baselines-master/baselines/gail/checkpoint/trpo_gail.transitionlimitation-1.Hopper/trpo_gail.transitionlimitation-1.Hopper') It does not work. What args should I write to load it?

Kailiangdong commented 4 years ago

me, too. It told me the string I give is a directory. Should I give path of one of these three?

Su-Lemon commented 4 years ago

Hello, I also have this problem. Could you tell me how you solved it?

Su-Lemon commented 4 years ago

Hello, I also have this problem. Could you tell me how you solved it?

Kailiangdong commented 4 years ago

parser.add_argument('--load_model_path', help='if provided, load the model', type=str, default='./baselines/checkpoint/BC.commonroad.trajlimitation-1.seed_1')

ob_space = env.observation_space ac_space = env.action_space pi = policy_func("pi", ob_space, ac_space, reuse=reuse) variables = tf.contrib.framework.get_variables_to_restore() variables_to_restore = [v for v in variables if v.name.split('/')[0]=='pi'] saver = tf.train.Saver(variables_to_restore) saver.restore(tf.get_default_session(), tf.train.latest_checkpoint(load_model_path))

Su-Lemon commented 4 years ago

Thanks for your tips. It solved this problem well. I understand that the reason for the problem is that the saved model is a collection of files generated by tensorflow, but when loading the model in U.load_variables(load_model_path), joblib.load is used