in minihack/agent/polybeast/evaluate.py [0:0]
def main():
parser = argparse.ArgumentParser(
description="Tool for evaluating pretrained models."
)
parser.add_argument(
"-e",
"--env",
type=str,
default="MiniHack-Room-15x15-v0",
help="Gym environment spec. Defaults to 'MiniHack-Room-15x15-v0'.",
)
parser.add_argument(
"-c",
"--checkpoint_dir",
type=str,
help="Path to checkpoint directory to load the model and configs. "
+ "This directory must include checkpoint.tar and config.yaml files.",
)
parser.add_argument(
"-o",
"--obs_keys",
type=str,
default="glyphs,chars,colors,specials,blstats,message",
help="The observation keys as a string. Separate keys using a comma",
)
parser.add_argument(
"-n",
"--num_episodes",
type=int,
default=5,
help="Number of episodes to be evaluated before exiting.",
)
parser.add_argument(
"--max-steps",
type=int,
default=10000,
help="Number of maximum steps per episode.",
)
parser.add_argument(
"--seeds",
default=None,
help="Seeds to send to NetHack. Can be a dict or int. "
"Defaults to None (no seeding).",
)
parser.add_argument(
"--savedir",
default=None,
help="Directory path where data will be saved. "
"Defaults to None (not data saved).",
)
parser.add_argument(
"--no-render", action="store_true", help="Disables env.render()."
)
parser.add_argument(
"--render_mode",
type=str,
default="human",
choices=["human", "full", "ansi"],
help="Render mode. Defaults to 'human'.",
)
parser.add_argument(
"--watch",
dest="watch",
action="store_true",
help="Pressing the Enter key performs a step.",
)
parser.add_argument(
"--no-watch",
dest="watch",
action="store_false",
help="Not watching the replay.",
)
parser.set_defaults(watch=True)
parser.add_argument(
"--save_gif",
dest="save_gif",
action="store_true",
help="Saving a GIF replay of the evaluated episodes.",
)
parser.add_argument(
"--no-save_gif",
dest="save_gif",
action="store_false",
help="Do not save GIF.",
)
parser.set_defaults(save_gif=False)
parser.add_argument(
"--gif_path",
type=str,
default="replay.gif",
help="Where to save the produced GIF file.",
)
parser.add_argument(
"--gif_duration",
type=int,
default=300,
help="The duration of each gif image.",
)
flags = parser.parse_args()
if flags.savedir == "args":
flags.savedir = "{}_{}_{}.zip".format(
time.strftime("%Y%m%d-%H%M%S"), flags.mode, flags.env
)
if flags.save_gif and "pixel_crop" not in flags.obs_keys:
flags.obs_keys += ",pixel_crop"
eval(**vars(flags))