updating bc experiment, adding automatic config copying, fixing idm/expert running from file issues in eval_experiments
This commit is contained in:
@@ -142,7 +142,7 @@ if __name__ == '__main__':
|
|||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--train', choices=['A', 'B'])
|
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', 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_seeds', type=int, default=5)
|
||||||
parser.add_argument('--test_cpus', type=int, help='number of cpus available to split test seed training over')
|
parser.add_argument('--test_cpus', type=int, help='number of cpus available to split test seed training over')
|
||||||
@@ -163,9 +163,9 @@ if __name__ == '__main__':
|
|||||||
'policy': {
|
'policy': {
|
||||||
'learning_rate': 3e-4,
|
'learning_rate': 3e-4,
|
||||||
'learning_rate_decay': tune.grid_search([0.999, 1.0]),
|
'learning_rate_decay': tune.grid_search([0.999, 1.0]),
|
||||||
'hidden_layer_size': tune.grid_search([10, 20, 40, 80]),
|
'hidden_layer_size': tune.grid_search([10, 20, 40]),
|
||||||
'n_hidden_layers': tune.grid_search([2, 3, 4]),
|
'n_hidden_layers': tune.grid_search([2, 3]),
|
||||||
'activation':0,
|
'activation':tune.grid_search([0, 1]),
|
||||||
},
|
},
|
||||||
'train_epochs': args.epochs,
|
'train_epochs': args.epochs,
|
||||||
'seed': 0,
|
'seed': 0,
|
||||||
@@ -210,3 +210,5 @@ if __name__ == '__main__':
|
|||||||
check_dir = analysis._checkpoints[i]['logdir']
|
check_dir = analysis._checkpoints[i]['logdir']
|
||||||
shutil.copyfile(os.path.join(check_dir,'policy_final.pt'),
|
shutil.copyfile(os.path.join(check_dir,'policy_final.pt'),
|
||||||
os.path.join(savepath, f'policy_seed{s}.pt'))
|
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
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ def main(method:str='expert', folder:str=None, locations=[(0,0)], skip_running=F
|
|||||||
print('%i policy files found in %s folder' %(len(files), folder))
|
print('%i policy files found in %s folder' %(len(files), folder))
|
||||||
print('found policy config', config['policy'])
|
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 = {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']]
|
policy_config['activation'] = activations[policy_config['activation']]
|
||||||
print('final policy config', policy_config)
|
print('final policy config', policy_config)
|
||||||
|
|
||||||
policy_kwargs.update(policy_config)
|
policy_kwargs.update(policy_config)
|
||||||
print('final policy kwargs', policy_kwargs)
|
print('final policy kwargs', policy_kwargs)
|
||||||
|
|
||||||
if not skip_running:
|
if not skip_running:
|
||||||
for policy_file in files:
|
for policy_file in files:
|
||||||
@@ -77,7 +77,7 @@ def latex_print(am, light=False):
|
|||||||
print('success rate, distance travelled, RWSE_10, |DeltaV|, AccelJSD')
|
print('success rate, distance travelled, RWSE_10, |DeltaV|, AccelJSD')
|
||||||
if light:
|
if light:
|
||||||
if 'rwse_10s' in am.keys():
|
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],
|
"%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] ))
|
am['average absolute average velocity'][0],am['acceleration distribution divergence'][0] ))
|
||||||
return
|
return
|
||||||
@@ -88,7 +88,7 @@ def latex_print(am, light=False):
|
|||||||
return
|
return
|
||||||
|
|
||||||
print("%2.1f \\scriptstyle\\pm %2.1f & %2.1f \\scriptstyle\\pm %2.1f & "
|
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],
|
"%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['mean travel distance'][0] , am['mean travel distance'][1] ,
|
||||||
am['rwse_10s'][0] , am['rwse_10s'][1] ,
|
am['rwse_10s'][0] , am['rwse_10s'][1] ,
|
||||||
|
|||||||
@@ -236,3 +236,5 @@ if __name__ == '__main__':
|
|||||||
check_dir = analysis._checkpoints[i]['logdir']
|
check_dir = analysis._checkpoints[i]['logdir']
|
||||||
shutil.copyfile(os.path.join(check_dir,'policy_final.pt'),
|
shutil.copyfile(os.path.join(check_dir,'policy_final.pt'),
|
||||||
os.path.join(savepath, f'policy_seed{s}.pt'))
|
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
|
||||||
@@ -259,3 +259,5 @@ if __name__ == '__main__':
|
|||||||
check_dir = analysis._checkpoints[i]['logdir']
|
check_dir = analysis._checkpoints[i]['logdir']
|
||||||
shutil.copyfile(os.path.join(check_dir,'policy_final.pt'),
|
shutil.copyfile(os.path.join(check_dir,'policy_final.pt'),
|
||||||
os.path.join(savepath, f'policy_seed{s}.pt'))
|
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
|
||||||
Reference in New Issue
Block a user