| 44 | |
| 45 | |
| 46 | def get_parser(): |
| 47 | parser = argparse.ArgumentParser(description="GraphVite command line executor v%s" % gv.__version__) |
| 48 | command = parser.add_subparsers(metavar="command", dest="command") |
| 49 | command.required = True |
| 50 | |
| 51 | new = command.add_parser("new", help="create a new configuration file") |
| 52 | new.add_argument("application", help="name of the application (e.g. graph)", nargs="+") |
| 53 | new.add_argument("--file", help="yaml file to save") |
| 54 | |
| 55 | run = command.add_parser("run", help="run from configuration file") |
| 56 | run.add_argument("config", help="yaml configuration file") |
| 57 | run.add_argument("--no-eval", help="turn off evaluation", dest="eval", action="store_false") |
| 58 | run.add_argument("--gpu", help="override the number of GPUs", type=int) |
| 59 | run.add_argument("--cpu", help="override the number of CPUs per GPU", type=int) |
| 60 | run.add_argument("--epoch", help="override the number of epochs", type=int) |
| 61 | |
| 62 | visualize = command.add_parser("visualize", help="visualize high-dimensional vectors") |
| 63 | visualize.add_argument("file", help="data file (numpy dump or txt)") |
| 64 | visualize.add_argument("--label", help="label file (numpy dump or txt)") |
| 65 | visualize.add_argument("--save", help="png or pdf file to save") |
| 66 | visualize.add_argument("--perplexity", help="perplexity for the neighborhood", type=float, default=30) |
| 67 | visualize.add_argument("--3d", help="3d plot", dest="dim", action="store_const", const=3, default=2) |
| 68 | |
| 69 | baseline = command.add_parser("baseline", help="reproduce baseline benchmarks") |
| 70 | baseline.add_argument("keywords", help="any keyword of the baseline (e.g. model, dataset)", metavar="keyword", |
| 71 | nargs="+") |
| 72 | baseline.add_argument("--no-eval", help="turn off evaluation", dest="eval", action="store_false") |
| 73 | baseline.add_argument("--gpu", help="overwrite the number of GPUs", type=int) |
| 74 | baseline.add_argument("--cpu", help="overwrite the number of CPUs per GPU", type=int) |
| 75 | baseline.add_argument("--epoch", help="override the number of epochs", type=int) |
| 76 | |
| 77 | list = command.add_parser("list", help="list available baselines") |
| 78 | |
| 79 | return parser |
| 80 | |
| 81 | |
| 82 | def load_config(config_file): |