Commit c1db8944 authored by nilabha's avatar nilabha

added support for render thru r flag, sample configs for training and evaluation

parent 56ee893a
Pipeline #5032 failed with stage
in 2 minutes and 38 seconds
evaluation_num_workers: 2 evaluation_num_workers: 2
# Evaluation wokers for the evaluation run. # Evaluation wokers for the evaluation run.
evaluation_interval: 50 evaluation_interval: 50
# Episodes each time evaluation runs. # Episodes each time evaluation runs. Reduced episodes for rendering
evaluation_num_episodes: 50 evaluation_num_episodes: 5
# Override the env config for evaluation. # Override the env config for evaluation.
evaluation_config: evaluation_config:
explore: False explore: False
......
evaluation_num_workers: 2
# Enable evaluation, once per training iteration.
evaluation_interval: 1
# Run 1 episode each time evaluation runs.
evaluation_num_episodes: 2
# Override the env config for evaluation.
evaluation_config:
explore: False
env_config:
seed: 100
\ No newline at end of file
...@@ -8,4 +8,5 @@ evaluation_config: ...@@ -8,4 +8,5 @@ evaluation_config:
explore: False explore: False
env_config: env_config:
seed: 100 seed: 100
render: human render: human
\ No newline at end of file # video_dir: small_tree_video
\ No newline at end of file
...@@ -33,7 +33,7 @@ flatland-sparse-small-action-mask-tree-fc-apex: ...@@ -33,7 +33,7 @@ flatland-sparse-small-action-mask-tree-fc-apex:
wandb: wandb:
project: neurips2020-flatland-baselines project: neurips2020-flatland-baselines
entity: nilabha2007 entity: aicrowd
tags: ["small_v0", "new_tree_obs", "apex", "skip_no_choice_cells", tags: ["small_v0", "new_tree_obs", "apex", "skip_no_choice_cells",
"action_mask"] # TODO should be set programmatically "action_mask"] # TODO should be set programmatically
......
...@@ -19,7 +19,7 @@ flatland-render-test: ...@@ -19,7 +19,7 @@ flatland-render-test:
rollout_fragment_length: 50 # 100 rollout_fragment_length: 50 # 100
sgd_minibatch_size: 100 # 500 sgd_minibatch_size: 100 # 500
num_sgd_iter: 10 num_sgd_iter: 10
num_workers: 2 num_workers: 1
num_envs_per_worker: 1 num_envs_per_worker: 1
batch_mode: truncate_episodes batch_mode: truncate_episodes
observation_filter: NoFilter observation_filter: NoFilter
...@@ -31,20 +31,21 @@ flatland-render-test: ...@@ -31,20 +31,21 @@ flatland-render-test:
observation: new_tree observation: new_tree
skip_no_choice_cells: True skip_no_choice_cells: True
available_actions_obs: True available_actions_obs: True
render: human # render: human
# For saving videos in custom folder and to wandb. # For saving videos in custom folder and to wandb.
# By default if not specified folder is flatland # By default if not specified folder is flatland
video_dir: small_tree_video # video_dir: small_tree_video
observation_config: observation_config:
max_depth: 2 max_depth: 2
shortest_path_max_depth: 30 shortest_path_max_depth: 30
generator: sparse_rail_generator generator: sparse_rail_generator
generator_config: small_v0 generator_config: small_v0
eval_generator: test_render
wandb: wandb:
project: neurips2020-flatland-baselines project: neurips2020-flatland-baselines
entity: nilabha2007 entity: aicrowd
tags: ["small_v0", "tree_obs"] # TODO should be set programmatically tags: ["small_v0", "tree_obs"] # TODO should be set programmatically
# monitor_gym: True # Wandb video doesn't seem to work # monitor_gym: True # Wandb video doesn't seem to work
......
...@@ -189,8 +189,12 @@ def run(args, parser): ...@@ -189,8 +189,12 @@ def run(args, parser):
} }
if args.eval: if args.eval:
eval_configs = get_eval_config(exp['config'].get('env_config',\ eval_configs_file = exp['config'].get('env_config',\
{}).get('eval_generator',"default")) {}).get('eval_generator',"default")
if args.record:
eval_configs_file = exp['config'].get('env_config',\
{}).get('eval_generator',"default_render")
eval_configs = get_eval_config(eval_configs_file)
eval_seed = eval_configs.get('evaluation_config',{}).get('env_config',{}).get('seed') eval_seed = eval_configs.get('evaluation_config',{}).get('env_config',{}).get('seed')
eval_render = eval_configs.get('evaluation_config',{}).get('env_config',{}).get('render') eval_render = eval_configs.get('evaluation_config',{}).get('env_config',{}).get('render')
...@@ -205,7 +209,10 @@ def run(args, parser): ...@@ -205,7 +209,10 @@ def run(args, parser):
if eval_render and eval_env_config: if eval_render and eval_env_config:
# We override the env render from the evaluation config # We override the env render from the evaluation config
eval_env_config['render'] = eval_render eval_env_config['render'] = eval_render
# Set video_dir if it exists
eval_render_dir = eval_configs.get('evaluation_config',{}).get('env_config',{}).get('video_dir')
if eval_render_dir:
eval_env_config['video_dir'] = eval_render_dir
# Remove any wandb related configs # Remove any wandb related configs
if eval_env_config: if eval_env_config:
if eval_env_config.get('wandb'): if eval_env_config.get('wandb'):
......
...@@ -105,13 +105,20 @@ def create_parser(parser_creator=None): ...@@ -105,13 +105,20 @@ def create_parser(parser_creator=None):
"--eval", "--eval",
action="store_true", action="store_true",
help="Whether to run evaluation. Default evaluation config is default.yaml " help="Whether to run evaluation. Default evaluation config is default.yaml "
"to use custom evaluation config set (eval_generator:high_eval) under configs") "to use custom evaluation config set (eval_generator:test_eval) under configs")
parser.add_argument( parser.add_argument(
"-i", "-i",
"--custom-fn", "--custom-fn",
action="store_true", action="store_true",
help="Whether the experiment uses a custom function for training" help="Whether the experiment uses a custom function for training"
"Default custom function is imitation_ppo_train_fn") "Default custom function is imitation_ppo_train_fn")
parser.add_argument(
"-r",
"--record",
action="store_true",
help="Whether the experiment requires video recording during evaluation"
"Default evaluation config is default_render.yaml "
"Can also be done via custom evaluation config set (eval_generator:test_render) under configs")
parser.add_argument( parser.add_argument(
"--bind-all", "--bind-all",
action="store_true", action="store_true",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment