in minihack/agent/polybeast/polyhydra.py [0:0]
def main(flags: DictConfig):
if os.path.exists("config.yaml"):
# this ignores the local config.yaml and replaces it completely with saved one
logging.info(
"loading existing configuration, we're continuing a previous run"
)
new_flags = OmegaConf.load("config.yaml")
cli_conf = OmegaConf.from_cli()
# however, you can override parameters from the cli still
# this is useful e.g. if you did total_steps=N before and want to increase it
flags = OmegaConf.merge(new_flags, cli_conf)
logging.info(OmegaConf.to_yaml(flags))
OmegaConf.save(flags, "config.yaml")
flags = get_common_flags(flags)
# check the name of the environment
if flags.env not in tasks.ENVS:
if is_env_registered(flags.env):
flags.env = get_env_shortcut(flags.env)
else:
raise KeyError(
f"Could not find an environement with a name: {flags.env}."
)
# set flags for polybeast_env
env_flags = get_environment_flags(flags)
env_processes = []
for _ in range(1):
p = mp.Process(target=run_env, args=(env_flags,))
p.start()
env_processes.append(p)
symlink_latest(
flags.savedir, os.path.join(hydra.utils.get_original_cwd(), "latest")
)
lrn_flags = get_learner_flags(flags)
run_learner(lrn_flags)
for p in env_processes:
p.kill()
p.join()