def main(args): search_config = json.load(open(args.config, "r")) assert "search_space" in search_config and "fixed_args" in search_config search_space = search_config["search_space"] fixed_args = search_config["fixed_args"] configs = config_generator(search_space, args.max_search, random.Random(args.search_seed), True) for search_conf in configs: full_conf = {} full_conf.update(search_conf) if any([k in full_conf for k in fixed_args.keys()]): raise ValueError("Fixed arg shows up in search space.") full_conf.update(fixed_args) if args.device: full_conf.update({"device": args.device}) arg_list = [] for k, v in full_conf.items(): # make sure the double quotes are correctly formatted if isinstance(v, dict): v = json.dumps(v) arg_list.extend([f"--{k}", str(v)]) # print command being run print("*" * 80) print("python run.py", " ".join(arg_list)) print("*" * 80) parser = get_parser() launch_args = parser.parse_args(arg_list) launch(launch_args)
def main(): parser = get_parser() args = parser.parse_args() run_exp(**vars(args))