Closed darshitajain closed 2 years ago
You'll probably want to call rollout(env[0], polichy, animated=True)
, since env
is actually a list of environments in this case.
hi darshitajain! I would like to know if you have solved this problem, as I am also experiencing this problem. I would be grateful if you could help!
Hi @ruffiann. I was unable to resolve that. Due to time constraints, I switched to a different RL environment.
I was referring to this document - https://garage.readthedocs.io/en/latest/user/reuse_garage_policy.html to visualize the RL2-PPO model, trained on Metaworld's ML1 Push-v2 environment for 700 epochs.
Below is the code used for visualizing the trained policy-
`# Load the policy and the env in which it was trained from garage.experiment import Snapshotter import tensorflow as tf # optional, only for TensorFlow as we need a tf.Session import metaworld import random
To check if it worked with the environment on which it was trained
ml1 = metaworld.ML1('push-v2') # Construct the benchmark, sampling tasks
env = ml1.train_classes['push-v2']() # Create an environment with task
pick_place
task = random.choice(ml1.train_tasks)
env.set_task(task) # Set task
snapshotter = Snapshotter() with tf.compat.v1.Session(): # optional, only for TensorFlow data = snapshotter.load('data/local/experiment/rl2_ppo_metaworld_ml1_push_resume_training_3') policy = data['algo'].policy env = data['env'] print('env', env) print("Data dictionary",data)
from garage import rollout path = rollout(env, policy, animated=True) print(path) `
This was the output I got-
I used this script https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/rl2_ppo_metaworld_ml1_push.py for training. This is the TensorBoard visualization after training for 700 epochs. https://tensorboard.dev/experiment/uvK1lPVSQmWDDJQerP0bEQ/#scalars
Request your help @haydenshively @krzentner
Thank you.