From 37d4475810e2abb34994382882ea48d02749d5a6 Mon Sep 17 00:00:00 2001 From: chenfeiyu Date: Tue, 8 Dec 2020 10:56:47 +0800 Subject: [PATCH] add default argument parser --- parakeet/training/cli.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 parakeet/training/cli.py diff --git a/parakeet/training/cli.py b/parakeet/training/cli.py new file mode 100644 index 0000000..800c3a3 --- /dev/null +++ b/parakeet/training/cli.py @@ -0,0 +1,21 @@ +import argparse + +def default_argument_parser(): + parser = argparse.ArgumentParser() + + # data and outpu + parser.add_argument("--config", metavar="FILE", help="path of the config file to overwrite to default config with.") + parser.add_argument("--data", metavar="DATA_DIR", help="path to the datatset.") + parser.add_argument("--output", metavar="OUTPUT_DIR", help="path to save checkpoint and log. If not provided, a directory is created in runs/ to save outputs.") + + # load from saved checkpoint + parser.add_argument("--checkpoint_path", type=str, help="path of the checkpoint to load") + + # running + parser.add_argument("--device", type=str, choices=["cpu", "gpu"], help="device type to use, cpu and gpu are supported.") + parser.add_argument("--nprocs", type=int, default=1, help="number of parallel processes to use.") + + # overwrite extra config and default config + parser.add_argument("--opts", nargs=argparse.REMAINDER, help="options to overwrite --config file and the default config, passing in KEY VALUE pairs") + + return parser