|
12 | 12 |
|
13 | 13 | For example, we can run: |
14 | 14 |
|
| 15 | +TUNED_HPS_DIR=../src/imitation/scripts/config/tuned_hps |
15 | 16 | python commands.py \ |
16 | 17 | --name=run0 \ |
17 | | - --cfg_pattern=../benchmarking/*ai*_seals_walker_*.json \ |
| 18 | + --cfg_pattern=$TUNED_HPS_DIR/*ai*_seals_walker_*.json \ |
18 | 19 | --output_dir=output |
19 | 20 |
|
20 | 21 | And get the following commands printed out: |
21 | 22 |
|
22 | 23 | python -m imitation.scripts.train_adversarial airl \ |
23 | 24 | --capture=sys --name=run0 \ |
24 | 25 | --file_storage=output/sacred/$USER-cmd-run0-airl-0-a3531726 \ |
25 | | - with ../benchmarking/example_airl_seals_walker_best_hp_eval.json \ |
| 26 | + with ../src/imitation/scripts/config/tuned_hps/airl_seals_walker_best_hp_eval.json \ |
26 | 27 | seed=0 logging.log_root=output |
27 | 28 |
|
28 | 29 | python -m imitation.scripts.train_adversarial gail \ |
29 | 30 | --capture=sys --name=run0 \ |
30 | 31 | --file_storage=output/sacred/$USER-cmd-run0-gail-0-a1ec171b \ |
31 | | - with ../benchmarking/example_gail_seals_walker_best_hp_eval.json \ |
| 32 | + with $TUNED_HPS_DIR/gail_seals_walker_best_hp_eval.json \ |
32 | 33 | seed=0 logging.log_root=output |
33 | 34 |
|
34 | 35 | We can execute commands in parallel by piping them to GNU parallel: |
|
40 | 41 |
|
41 | 42 | For example, we can run: |
42 | 43 |
|
| 44 | +TUNED_HPS_DIR=../src/imitation/scripts/config/tuned_hps |
43 | 45 | python commands.py \ |
44 | 46 | --name=run0 \ |
45 | | - --cfg_pattern=../benchmarking/example_bc_seals_half_cheetah_best_hp_eval.json \ |
| 47 | + --cfg_pattern=$TUNED_HPS_DIR/bc_seals_half_cheetah_best_hp_eval.json \ |
46 | 48 | --output_dir=/data/output \ |
47 | 49 | --remote |
48 | 50 |
|
|
51 | 53 | ctl job run --name $USER-cmd-run0-bc-0-72cb1df3 \ |
52 | 54 | --command "python -m imitation.scripts.train_imitation bc \ |
53 | 55 | --capture=sys --name=run0 \ |
54 | | - --file_storage=/data/output/sacred/$USER-cmd-run0-bc-0-72cb1df3 \ |
55 | | - with /data/imitation/benchmarking/example_bc_seals_half_cheetah_best_hp_eval.json \ |
| 56 | + --file_storage=/data/output/sacred/$USER-cmd-run0-bc-0-72cb1df3 with \ |
| 57 | + /data/imitation/src/imitation/scripts/config/tuned_hps/ |
| 58 | + bc_seals_half_cheetah_best_hp_eval.json \ |
56 | 59 | seed=0 logging.log_root=/data/output" \ |
57 | 60 | --container hacobe/devbox:imitation \ |
58 | 61 | --login --force-pull --never-restart --gpu 0 --shared-host-dir-mount /data |
@@ -85,7 +88,7 @@ def _get_algo_name(cfg_file: str) -> str: |
85 | 88 | """Get the algorithm name from the given config filename.""" |
86 | 89 | algo_names = set() |
87 | 90 | for key in _ALGO_NAME_TO_SCRIPT_NAME: |
88 | | - if cfg_file.find("_" + key + "_") != -1: |
| 91 | + if cfg_file.find(key + "_") != -1: |
89 | 92 | algo_names.add(key) |
90 | 93 |
|
91 | 94 | if len(algo_names) == 0: |
@@ -121,7 +124,7 @@ def main(args: argparse.Namespace) -> None: |
121 | 124 | else: |
122 | 125 | cfg_path = os.path.join(args.remote_cfg_dir, cfg_file) |
123 | 126 |
|
124 | | - cfg_id = _get_cfg_id(cfg_path) |
| 127 | + cfg_id = _get_cfg_id(cfg_file) |
125 | 128 |
|
126 | 129 | for seed in args.seeds: |
127 | 130 | cmd_id = _CMD_ID_TEMPLATE.format( |
@@ -177,19 +180,19 @@ def parse() -> argparse.Namespace: |
177 | 180 | parser.add_argument( |
178 | 181 | "--cfg_pattern", |
179 | 182 | type=str, |
180 | | - default="example_bc_seals_half_cheetah_best_hp_eval.json", |
| 183 | + default="bc_seals_half_cheetah_best_hp_eval.json", |
181 | 184 | help="""Generate a command for every file that matches this glob pattern. \ |
182 | 185 | Each matching file should be a config file that has its algorithm name \ |
183 | 186 | (bc, dagger, airl or gail) bookended by underscores in the filename. \ |
184 | 187 | If the --remote flag is enabled, then generate a command for every file in the \ |
185 | 188 | --remote_cfg_dir directory that has the same filename as a file that matches this \ |
186 | 189 | glob pattern. E.g., suppose the current, local working directory is 'foo' and \ |
187 | | -the subdirectory 'foo/bar' contains the config files 'example_bc_best.json' and \ |
188 | | -'example_dagger_best.json'. If the pattern 'bar/*.json' is supplied, then globbing \ |
189 | | -will return ['bar/example_bc_best.json', 'bar/example_dagger_best.json']. \ |
| 190 | +the subdirectory 'foo/bar' contains the config files 'bc_best.json' and \ |
| 191 | +'dagger_best.json'. If the pattern 'bar/*.json' is supplied, then globbing \ |
| 192 | +will return ['bar/bc_best.json', 'bar/dagger_best.json']. \ |
190 | 193 | If the --remote flag is enabled, 'bar' will be replaced with `remote_cfg_dir` and \ |
191 | 194 | commands will be created for the following configs: \ |
192 | | -[`remote_cfg_dir`/example_bc_best.json, `remote_cfg_dir`/example_dagger_best.json] \ |
| 195 | +[`remote_cfg_dir`/bc_best.json, `remote_cfg_dir`/dagger_best.json] \ |
193 | 196 | Why not just supply the pattern '`remote_cfg_dir`/*.json' directly? \ |
194 | 197 | Because the `remote_cfg_dir` directory may not exist on the local machine.""", |
195 | 198 | ) |
@@ -220,7 +223,7 @@ def parse() -> argparse.Namespace: |
220 | 223 | parser.add_argument( |
221 | 224 | "--remote_cfg_dir", |
222 | 225 | type=str, |
223 | | - default="/data/imitation/benchmarking", |
| 226 | + default="/data/imitation/src/imitation/scripts/config/tuned_hps", |
224 | 227 | help="""Path to a directory storing config files \ |
225 | 228 | accessible from each container. """, |
226 | 229 | ) |
|
0 commit comments