diff --git a/bc-experiment.py b/bc-experiment.py index b50489b..1f1f0cf 100644 --- a/bc-experiment.py +++ b/bc-experiment.py @@ -142,7 +142,7 @@ if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument('--train', choices=['A', 'B']) - parser.add_argument('--epochs', type=int, default=1000) + parser.add_argument('--epochs', type=int, default=500) parser.add_argument('--test', type=str, help='path to config file to run final training on') parser.add_argument('--test_seeds', type=int, default=5) parser.add_argument('--test_cpus', type=int, help='number of cpus available to split test seed training over') @@ -162,10 +162,10 @@ if __name__ == '__main__': }, 'policy': { 'learning_rate': 3e-4, - 'learning_rate_decay': 1.0, - 'hidden_layer_size': tune.grid_search([20, 40]), + 'learning_rate_decay': tune.grid_search([0.999, 1.0]), + 'hidden_layer_size': tune.grid_search([10, 20, 40]), 'n_hidden_layers': tune.grid_search([2, 3]), - 'activation':0, + 'activation':tune.grid_search([0, 1]), }, 'train_epochs': args.epochs, 'seed': 0, @@ -209,4 +209,6 @@ if __name__ == '__main__': s = analysis._checkpoints[i]['config']['seed'] check_dir = analysis._checkpoints[i]['logdir'] shutil.copyfile(os.path.join(check_dir,'policy_final.pt'), - os.path.join(savepath, f'policy_seed{s}.pt')) \ No newline at end of file + os.path.join(savepath, f'policy_seed{s}.pt')) + shutil.copyfile(os.path.join(check_dir,'params.json'), + os.path.join(savepath, 'config.json')) # copy config automatically diff --git a/best_configs/hail-etienne2_expA.json b/best_configs/hail-etienne2_expA.json deleted file mode 100644 index a43762d..0000000 --- a/best_configs/hail-etienne2_expA.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "A", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": null, - "abort_unsafe_collision_method": null - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 10, - "n_hidden_layers": 3, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/best_configs/hail-etienne2_expB.json b/best_configs/hail-etienne2_expB.json deleted file mode 100644 index 6425d4f..0000000 --- a/best_configs/hail-etienne2_expB.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "B", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": null, - "abort_unsafe_collision_method": null - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 10, - "n_hidden_layers": 3, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/best_configs/hail-etienne3_expB.json b/best_configs/hail-etienne3_expB.json deleted file mode 100644 index c75cfb5..0000000 --- a/best_configs/hail-etienne3_expB.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "B", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": null, - "abort_unsafe_collision_method": null - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 40, - "n_hidden_layers": 3, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/best_configs/hail-etienne_expA.json b/best_configs/hail-etienne_expA.json deleted file mode 100644 index dbf59ca..0000000 --- a/best_configs/hail-etienne_expA.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "A", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": null, - "abort_unsafe_collision_method": null - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 20, - "n_hidden_layers": 4, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/best_configs/shail-etienne2_expA.json b/best_configs/shail-etienne2_expA.json deleted file mode 100644 index a3f6b90..0000000 --- a/best_configs/shail-etienne2_expA.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "A", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": "circle", - "abort_unsafe_collision_method": "circle" - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 10, - "n_hidden_layers": 3, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/best_configs/shail-etienne2_expB.json b/best_configs/shail-etienne2_expB.json deleted file mode 100644 index 096f2ea..0000000 --- a/best_configs/shail-etienne2_expB.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "B", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": "circle", - "abort_unsafe_collision_method": "circle" - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 10, - "n_hidden_layers": 3, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/best_configs/shail-etienne3_expB.json b/best_configs/shail-etienne3_expB.json deleted file mode 100644 index d0d0b69..0000000 --- a/best_configs/shail-etienne3_expB.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "B", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": "circle", - "abort_unsafe_collision_method": "circle" - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 40, - "n_hidden_layers": 3, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/best_configs/shail-etienne_expA.json b/best_configs/shail-etienne_expA.json deleted file mode 100644 index 6de9706..0000000 --- a/best_configs/shail-etienne_expA.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "experiment": "A", - "trainenv": { - "stop_on_collision": false, - "safe_actions_collision_method": "circle", - "abort_unsafe_collision_method": "circle" - }, - "policy": { - "learning_rate": 0.0003, - "learning_rate_decay": 1.0, - "clip_ratio": 0.2, - "iterations_per_epoch": 100, - "hidden_layer_size": 20, - "n_hidden_layers": 4, - "activation": 0, - "option": 0 - }, - "value": { - "learning_rate": 0.001, - "iterations_per_epoch": 1000 - }, - "discriminator": { - "learning_rate": 0.001, - "weight_decay": 0.0001, - "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, - "hidden_layer_size": 10, - "activation": 0 - }, - "train_epochs": 100, - "seed": 0 -} \ No newline at end of file diff --git a/eval_experiments.py b/eval_experiments.py index f9f1c8e..109c5d5 100644 --- a/eval_experiments.py +++ b/eval_experiments.py @@ -1,17 +1,23 @@ import os from src.eval_main import eval_main from src.evaluation.utils import load_and_average +import torch +import json + +activations = [torch.nn.Tanh, torch.nn.LeakyReLU] def main(method:str='expert', folder:str=None, locations=[(0,0)], skip_running=False): + exclude_keys_from_policy_kwargs = {'learning_rate', 'learning_rate_decay', 'clip_ratio', 'iterations_per_epoch', 'option'} policy_kwargs = {} + if method in ['expert', 'idm']: env, env_kwargs ='NRasterizedRouteIncrementingAgent', {} elif method in ['bc','gail']: env='NormalizedContinuousEvalEnv' env_kwargs={'stop_on_collision':True, 'max_episode_steps':1000} elif method in ['hail']: - env = 'NormalizedOptionsEvalEnv' + env = 'NormalizedSafeOptionsEvalEnv' env_kwargs={'stop_on_collision':True, 'max_episode_steps':1000, 'safe_actions_collision_method': None, 'abort_unsafe_collision_method': None} elif method in ['shail']: env = 'NormalizedSafeOptionsEvalEnv' @@ -23,7 +29,18 @@ def main(method:str='expert', folder:str=None, locations=[(0,0)], skip_running=F if folder is not None: files = [os.path.join(folder, f) for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f))] - print('%i folders found in %s folder' %(len(files), folder)) + files = [f for f in files if f.endswith('.pt')] + with open(os.path.join(folder, 'config.json'), 'rb') as f: + config = json.load(f) + print('%i policy files found in %s folder' %(len(files), folder)) + print('found policy config', config['policy']) + + policy_config = {k: v for k, v in config['policy'].items() if k not in exclude_keys_from_policy_kwargs} + policy_config['activation'] = activations[policy_config['activation']] + print('final policy config', policy_config) + + policy_kwargs.update(policy_config) + print('final policy kwargs', policy_kwargs) if not skip_running: for policy_file in files: @@ -60,7 +77,7 @@ def latex_print(am, light=False): print('success rate, distance travelled, RWSE_10, |DeltaV|, AccelJSD') if light: if 'rwse_10s' in am.keys(): - print("%2.1f& %2.1f & %1.2f & %2.1f& " + print("%2.1f& %2.1f & %2.1f & %1.2f& " "%0.3f \\\\" %( 100*am['success rate'][0], am['mean travel distance'][0], am['rwse_10s'][0], am['average absolute average velocity'][0],am['acceleration distribution divergence'][0] )) return @@ -71,7 +88,7 @@ def latex_print(am, light=False): return print("%2.1f \\scriptstyle\\pm %2.1f & %2.1f \\scriptstyle\\pm %2.1f & " - "%1.2f \\scriptstyle\\pm %1.2f & %2.1f \\scriptstyle\\pm %1.1f & " + "%2.1f \\scriptstyle\\pm %1.1f & %1.2f \\scriptstyle\\pm %1.2f & " "%0.3f \\scriptstyle\\pm %0.3f \\\\" %( 100*am['success rate'][0], 100*am['success rate'][1], am['mean travel distance'][0] , am['mean travel distance'][1] , am['rwse_10s'][0] , am['rwse_10s'][1] , diff --git a/gail-experiment.py b/gail-experiment.py index 68c9ae9..eb7cec4 100644 --- a/gail-experiment.py +++ b/gail-experiment.py @@ -235,4 +235,6 @@ if __name__ == '__main__': s = analysis._checkpoints[i]['config']['seed'] check_dir = analysis._checkpoints[i]['logdir'] shutil.copyfile(os.path.join(check_dir,'policy_final.pt'), - os.path.join(savepath, f'policy_seed{s}.pt')) \ No newline at end of file + os.path.join(savepath, f'policy_seed{s}.pt')) + shutil.copyfile(os.path.join(check_dir,'params.json'), + os.path.join(savepath, 'config.json')) # copy config automatically \ No newline at end of file diff --git a/out/hail/expA/loc_r0t0/policy_seed1_tseed0_comparison.pkl b/out/hail/expA/loc_r0t0/policy_seed1_tseed0_comparison.pkl new file mode 100644 index 0000000..7124f47 Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed1_tseed0_comparison.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed1_tseed0_summary.pkl b/out/hail/expA/loc_r0t0/policy_seed1_tseed0_summary.pkl new file mode 100644 index 0000000..4d5445b Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed1_tseed0_summary.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed2_tseed0_comparison.pkl b/out/hail/expA/loc_r0t0/policy_seed2_tseed0_comparison.pkl new file mode 100644 index 0000000..21080b0 Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed2_tseed0_comparison.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed2_tseed0_summary.pkl b/out/hail/expA/loc_r0t0/policy_seed2_tseed0_summary.pkl new file mode 100644 index 0000000..25d7530 Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed2_tseed0_summary.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed3_tseed0_comparison.pkl b/out/hail/expA/loc_r0t0/policy_seed3_tseed0_comparison.pkl new file mode 100644 index 0000000..0c5887d Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed3_tseed0_comparison.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed3_tseed0_summary.pkl b/out/hail/expA/loc_r0t0/policy_seed3_tseed0_summary.pkl new file mode 100644 index 0000000..a3e0028 Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed3_tseed0_summary.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed4_tseed0_comparison.pkl b/out/hail/expA/loc_r0t0/policy_seed4_tseed0_comparison.pkl new file mode 100644 index 0000000..28510af Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed4_tseed0_comparison.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed4_tseed0_summary.pkl b/out/hail/expA/loc_r0t0/policy_seed4_tseed0_summary.pkl new file mode 100644 index 0000000..4f2eb72 Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed4_tseed0_summary.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed5_tseed0_comparison.pkl b/out/hail/expA/loc_r0t0/policy_seed5_tseed0_comparison.pkl new file mode 100644 index 0000000..da34354 Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed5_tseed0_comparison.pkl differ diff --git a/out/hail/expA/loc_r0t0/policy_seed5_tseed0_summary.pkl b/out/hail/expA/loc_r0t0/policy_seed5_tseed0_summary.pkl new file mode 100644 index 0000000..e9100b5 Binary files /dev/null and b/out/hail/expA/loc_r0t0/policy_seed5_tseed0_summary.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed1_tseed0_comparison.pkl b/out/hail/expB/loc_r0t4/policy_seed1_tseed0_comparison.pkl new file mode 100644 index 0000000..c4613bc Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed1_tseed0_comparison.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed1_tseed0_summary.pkl b/out/hail/expB/loc_r0t4/policy_seed1_tseed0_summary.pkl new file mode 100644 index 0000000..e3c4a99 Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed1_tseed0_summary.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed2_tseed0_comparison.pkl b/out/hail/expB/loc_r0t4/policy_seed2_tseed0_comparison.pkl new file mode 100644 index 0000000..ab7267d Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed2_tseed0_comparison.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed2_tseed0_summary.pkl b/out/hail/expB/loc_r0t4/policy_seed2_tseed0_summary.pkl new file mode 100644 index 0000000..595c8cc Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed2_tseed0_summary.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed3_tseed0_comparison.pkl b/out/hail/expB/loc_r0t4/policy_seed3_tseed0_comparison.pkl new file mode 100644 index 0000000..7af1fbf Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed3_tseed0_comparison.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed3_tseed0_summary.pkl b/out/hail/expB/loc_r0t4/policy_seed3_tseed0_summary.pkl new file mode 100644 index 0000000..d9567ec Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed3_tseed0_summary.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed4_tseed0_comparison.pkl b/out/hail/expB/loc_r0t4/policy_seed4_tseed0_comparison.pkl new file mode 100644 index 0000000..a153404 Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed4_tseed0_comparison.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed4_tseed0_summary.pkl b/out/hail/expB/loc_r0t4/policy_seed4_tseed0_summary.pkl new file mode 100644 index 0000000..16d97dd Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed4_tseed0_summary.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed5_tseed0_comparison.pkl b/out/hail/expB/loc_r0t4/policy_seed5_tseed0_comparison.pkl new file mode 100644 index 0000000..7052698 Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed5_tseed0_comparison.pkl differ diff --git a/out/hail/expB/loc_r0t4/policy_seed5_tseed0_summary.pkl b/out/hail/expB/loc_r0t4/policy_seed5_tseed0_summary.pkl new file mode 100644 index 0000000..59b21e1 Binary files /dev/null and b/out/hail/expB/loc_r0t4/policy_seed5_tseed0_summary.pkl differ diff --git a/shail-experiment.py b/shail-experiment.py index 4195759..e46d6bc 100644 --- a/shail-experiment.py +++ b/shail-experiment.py @@ -247,8 +247,17 @@ if __name__ == '__main__': os.makedirs(savepath) import shutil + + # save config + shutil.copyfile( + args.test, + os.path.join(savepath, 'config.json') + ) + for i in range(args.test_seeds): s = analysis._checkpoints[i]['config']['seed'] check_dir = analysis._checkpoints[i]['logdir'] shutil.copyfile(os.path.join(check_dir,'policy_final.pt'), - os.path.join(savepath, f'policy_seed{s}.pt')) \ No newline at end of file + os.path.join(savepath, f'policy_seed{s}.pt')) + shutil.copyfile(os.path.join(check_dir,'params.json'), + os.path.join(savepath, 'config.json')) # copy config automatically \ No newline at end of file diff --git a/src/eval_main.py b/src/eval_main.py index 2e50286..37e78bd 100644 --- a/src/eval_main.py +++ b/src/eval_main.py @@ -41,33 +41,33 @@ def load_policy(method:str, if method == 'idm': policy = IDMRulePolicy(env, **policy_kwargs) elif method == 'bc': - policy = SetPolicy(env.action_space.shape[-1]) + policy = SetPolicy(env.action_space.shape[-1], **policy_kwargs) policy.load_state_dict(torch.load(policy_file, map_location=ml)) policy.eval() elif method == 'gail-trpo': - policy = SetPolicy(env.action_space.shape[-1]) + policy = SetPolicy(env.action_space.shape[-1], **policy_kwargs) policy(torch.zeros(env.observation_space.shape)) policy = ReparamPolicy(policy) policy.load_state_dict(torch.load(policy_file, map_location=ml)) policy.eval() elif method == 'gail': - policy = SetPolicy(env.action_space.shape[-1]) + policy = SetPolicy(env.action_space.shape[-1], **policy_kwargs) policy.load_state_dict(torch.load(policy_file, map_location=ml)) policy.eval() elif method == 'rail': raise NotImplementedError elif method == 'hail-trpo': - policy = SetDiscretePolicy(env.action_space.n) + policy = SetMaskedDiscretePolicy(env.action_space.n, **policy_kwargs) policy(torch.zeros(env.observation_space.shape)) policy = ReparamPolicy(policy) policy.load_state_dict(torch.load(policy_file, map_location=ml)) policy.eval() elif method == 'hail': - policy = SetDiscretePolicy(env.action_space.n) + policy = SetMaskedDiscretePolicy(env.action_space.n, **policy_kwargs) policy.load_state_dict(torch.load(policy_file, map_location=ml)) policy.eval() elif method == 'shail-trpo': - policy = SetMaskedDiscretePolicy(env.action_space.n) + policy = SetMaskedDiscretePolicy(env.action_space.n, **policy_kwargs) policy( torch.zeros(env.observation_space['observation'].shape), torch.zeros(env.observation_space['safe_actions'].shape) @@ -76,7 +76,7 @@ def load_policy(method:str, policy.load_state_dict(torch.load(policy_file, map_location=ml)) policy.eval() elif method == 'shail': - policy = SetMaskedDiscretePolicy(env.action_space.n) + policy = SetMaskedDiscretePolicy(env.action_space.n, **policy_kwargs) policy.load_state_dict(torch.load(policy_file, map_location=ml)) policy.eval() else: diff --git a/test_policies/bc/expA/config.json b/test_policies/bc/expA/config.json new file mode 100644 index 0000000..42fee47 --- /dev/null +++ b/test_policies/bc/expA/config.json @@ -0,0 +1,15 @@ +{ + "experiment": "A", + "trainenv": { + "stop_on_collision": false + }, + "policy": { + "learning_rate": 0.0003, + "learning_rate_decay": 1.0, + "hidden_layer_size": 40, + "n_hidden_layers": 2, + "activation": 0 + }, + "train_epochs": 300, + "seed": 0 +} \ No newline at end of file diff --git a/test_policies/bc/expB/config.json b/test_policies/bc/expB/config.json new file mode 100644 index 0000000..9d81a2f --- /dev/null +++ b/test_policies/bc/expB/config.json @@ -0,0 +1,15 @@ +{ + "experiment": "B", + "trainenv": { + "stop_on_collision": false + }, + "policy": { + "learning_rate": 0.0003, + "learning_rate_decay": 1.0, + "hidden_layer_size": 40, + "n_hidden_layers": 2, + "activation": 0 + }, + "train_epochs": 300, + "seed": 0 +} \ No newline at end of file diff --git a/best_configs/gail-trpo_expA.json b/test_policies/gail/expA/config.json similarity index 96% rename from best_configs/gail-trpo_expA.json rename to test_policies/gail/expA/config.json index ff708f1..e254f61 100644 --- a/best_configs/gail-trpo_expA.json +++ b/test_policies/gail/expA/config.json @@ -6,7 +6,7 @@ "policy": { "learning_rate": 0.0003, "learning_rate_decay": 1.0, - "delta": 0.01, + "clip_ratio": 0.2, "iterations_per_epoch": 100, "hidden_layer_size": 40, "n_hidden_layers": 2, diff --git a/best_configs/gail-trpo_expB.json b/test_policies/gail/expB/config.json similarity index 96% rename from best_configs/gail-trpo_expB.json rename to test_policies/gail/expB/config.json index ae0fa67..b05e446 100644 --- a/best_configs/gail-trpo_expB.json +++ b/test_policies/gail/expB/config.json @@ -6,7 +6,7 @@ "policy": { "learning_rate": 0.0003, "learning_rate_decay": 1.0, - "delta": 0.01, + "clip_ratio": 0.2, "iterations_per_epoch": 100, "hidden_layer_size": 40, "n_hidden_layers": 2, diff --git a/best_configs/hail-etienne3_expA.json b/test_policies/hail/expA/config.json similarity index 84% rename from best_configs/hail-etienne3_expA.json rename to test_policies/hail/expA/config.json index 91775ab..ca9fe11 100644 --- a/best_configs/hail-etienne3_expA.json +++ b/test_policies/hail/expA/config.json @@ -11,7 +11,7 @@ "clip_ratio": 0.2, "iterations_per_epoch": 100, "hidden_layer_size": 40, - "n_hidden_layers": 3, + "n_hidden_layers": 2, "activation": 0, "option": 0 }, @@ -23,11 +23,11 @@ "learning_rate": 0.001, "weight_decay": 0.0001, "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, + "n_hidden_layers_element": 4, + "n_hidden_layers_global": 1, "hidden_layer_size": 10, "activation": 0 }, - "train_epochs": 100, + "train_epochs": 90, "seed": 0 } \ No newline at end of file diff --git a/best_configs/hail-etienne_expB.json b/test_policies/hail/expB/config.json similarity index 88% rename from best_configs/hail-etienne_expB.json rename to test_policies/hail/expB/config.json index 0fae03f..a93d5e1 100644 --- a/best_configs/hail-etienne_expB.json +++ b/test_policies/hail/expB/config.json @@ -11,7 +11,7 @@ "clip_ratio": 0.2, "iterations_per_epoch": 100, "hidden_layer_size": 20, - "n_hidden_layers": 4, + "n_hidden_layers": 2, "activation": 0, "option": 0 }, @@ -23,11 +23,11 @@ "learning_rate": 0.001, "weight_decay": 0.0001, "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, + "n_hidden_layers_element": 4, "n_hidden_layers_global": 2, "hidden_layer_size": 10, "activation": 0 }, - "train_epochs": 100, + "train_epochs": 85, "seed": 0 } \ No newline at end of file diff --git a/best_configs/shail-etienne3_expA.json b/test_policies/shail/expA/config.json similarity index 84% rename from best_configs/shail-etienne3_expA.json rename to test_policies/shail/expA/config.json index 385d63d..76472e0 100644 --- a/best_configs/shail-etienne3_expA.json +++ b/test_policies/shail/expA/config.json @@ -11,7 +11,7 @@ "clip_ratio": 0.2, "iterations_per_epoch": 100, "hidden_layer_size": 40, - "n_hidden_layers": 3, + "n_hidden_layers": 2, "activation": 0, "option": 0 }, @@ -23,11 +23,11 @@ "learning_rate": 0.001, "weight_decay": 0.0001, "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, - "n_hidden_layers_global": 2, + "n_hidden_layers_element": 4, + "n_hidden_layers_global": 1, "hidden_layer_size": 10, "activation": 0 }, - "train_epochs": 100, + "train_epochs": 90, "seed": 0 } \ No newline at end of file diff --git a/best_configs/shail-etienne_expB.json b/test_policies/shail/expB/config.json similarity index 88% rename from best_configs/shail-etienne_expB.json rename to test_policies/shail/expB/config.json index 04139c2..3a35200 100644 --- a/best_configs/shail-etienne_expB.json +++ b/test_policies/shail/expB/config.json @@ -11,7 +11,7 @@ "clip_ratio": 0.2, "iterations_per_epoch": 100, "hidden_layer_size": 20, - "n_hidden_layers": 4, + "n_hidden_layers": 2, "activation": 0, "option": 0 }, @@ -23,11 +23,11 @@ "learning_rate": 0.001, "weight_decay": 0.0001, "iterations_per_epoch": 100, - "n_hidden_layers_element": 3, + "n_hidden_layers_element": 4, "n_hidden_layers_global": 2, "hidden_layer_size": 10, "activation": 0 }, - "train_epochs": 100, + "train_epochs": 85, "seed": 0 } \ No newline at end of file