Generate videos of expert data
This commit is contained in:
@@ -11,7 +11,7 @@ def main(method:str='expert', folder:str=None, locations=[(0,0)], skip_running=F
|
||||
exclude_keys_from_policy_kwargs = {'learning_rate', 'learning_rate_decay', 'clip_ratio', 'iterations_per_epoch', 'option'}
|
||||
policy_kwargs = {}
|
||||
|
||||
if method in ['expert', 'idm']:
|
||||
if method in ['expert', 'expert_agent', 'idm']:
|
||||
env, env_kwargs ='NRasterizedRouteIncrementingAgent', {}
|
||||
elif method in ['bc','gail']:
|
||||
env='NormalizedContinuousEvalEnv'
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
# Experiment A
|
||||
python -m eval_experiments
|
||||
python -m eval_experiments --method expert_agent --save_videos
|
||||
python -m eval_experiments --method idm --save_videos
|
||||
python -m eval_experiments --method bc --folder='test_policies/bc/expA' --save_videos
|
||||
python -m eval_experiments --method gail --folder='test_policies/gail/expA' --save_videos
|
||||
@@ -11,6 +12,7 @@ python -m eval_experiments --method shail --folder='test_policies/shail/expA' --
|
||||
|
||||
# Experiment B
|
||||
python -m eval_experiments --locations='[(0,4)]'
|
||||
python -m eval_experiments --method expert_agent --locations='[(0,4)]' --save_videos
|
||||
python -m eval_experiments --method idm --locations='[(0,4)]' --save_videos
|
||||
python -m eval_experiments --method bc --folder='test_policies/bc/expB' --locations='[(0,4)]' --save_videos
|
||||
python -m eval_experiments --method gail --folder='test_policies/gail/expB' --locations='[(0,4)]' --save_videos
|
||||
|
||||
@@ -5,6 +5,7 @@ import intersim
|
||||
from intersim.envs import Intersimple
|
||||
from stable_baselines3.common.base_class import BaseAlgorithm
|
||||
from src.baselines import IDMRulePolicy
|
||||
from src.data.expert import NormalizedIntersimpleExpert
|
||||
from src.evaluation import IntersimpleEvaluation
|
||||
import src.gail.options as options_envs
|
||||
from src.evaluation.metrics import divergence, visualize_distribution, rwse
|
||||
@@ -40,6 +41,8 @@ def load_policy(method:str,
|
||||
ml = torch.device('cpu') if not torch.cuda.is_available() else None
|
||||
if method == 'idm':
|
||||
policy = IDMRulePolicy(env, **policy_kwargs)
|
||||
elif method == 'expert_agent':
|
||||
policy = NormalizedIntersimpleExpert(env, **policy_kwargs)
|
||||
elif method == 'bc':
|
||||
policy = SetPolicy(env.action_space.shape[-1], **policy_kwargs)
|
||||
policy.load_state_dict(torch.load(policy_file, map_location=ml))
|
||||
|
||||
Reference in New Issue
Block a user