def parse_args(): parser = ArgParser(allow_config=True) parser.add("--pred_path", type=path, required=True) parser.add("--gold_path", type=path, required=True) parser.add("--out_path", type=path, required=True) args = parser.parse_args() return args
def parse_args(): parser = ArgParser(allow_config=True) parser.add("--name", type=str, default="main") parser.add("--feats_path", type=path, action="append", required=True) parser.add("--feats_vocab", type=path, action="append", required=True) parser.add("--labels_path", type=path, required=True) parser.add("--labels_vocab", type=path, required=True) parser.add("--save_dir", type=path, required=True) parser.add("--gpu", action="store_true", default=False) parser.add("--n_previews", type=int, default=10) group = parser.add_group("Word Embedding Options") group.add("--wordembed_type", type=str, action="append", choices=["glove", "fasttext", "none"]) group.add("--wordembed_path", type=path, action="append") group.add("--fasttext_path", type=path, default=None) group.add("--wordembed_freeze", type=bool, action="append") group = parser.add_group("Training Options") group.add("--n_epochs", type=int, default=3) group.add("--dropout_prob", type=float, default=0.05) group.add("--batch_size", type=int, default=32) group.add("--max_len", type=int, default=30) group = parser.add_group("Save Options") group.add("--save", action="store_true", default=False) group.add("--save_period", type=int, default=1000) group = parser.add_group("Validation Options") group.add("--val", action="store_true", default=False) group.add("--val_period", type=int, default=100) group.add("--text_preview", action="store_true", default=False) group.add("--val_feats_path", type=path, action="append") group.add("--val_labels_path", type=path, default=None) group = parser.add_group("Visdom Options") group.add("--visdom_host", type=str, default="localhost") group.add("--visdom_port", type=int, default=8097) group.add("--visdom_buffer_size", type=int, default=10) group = parser.add_group("Model Parameters") group.add("--word_dim", type=int, action="append") group.add("--hidden_dim", type=int, required=True) args = parser.parse_args() return args
def main(): if settings.toml is None: sys.exit() if settings.toml['auto_update']: check_for_update() if sys.version_info[0] == 3 and sys.version_info[ 1] >= 7 and sys.platform.startswith('win'): asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) parser = ArgParser() if len(sys.argv) > 1: args = parser.parse_args(sys.argv[1:]) if args.date: folder_name = 'dates/' + args.region file_name = args.date.replace('/', '_') races = get_race_urls_date(parser.dates, args.region) else: folder_name = args.region if args.region else course_name( args.course) file_name = args.year races = get_race_urls(parser.tracks, parser.years, args.type) scrape_races(races, folder_name, file_name, args.type) else: if sys.platform == 'linux': import readline completions = Completer() readline.set_completer(completions.complete) readline.parse_and_bind('tab: complete') while True: args = input('[rpscrape]> ').lower().strip() args = parser.parse_args_interactive( [arg.strip() for arg in args.split()]) print(args) if args: if 'dates' in args: races = get_race_urls_date(args['dates'], args['region']) else: races = get_race_urls(args['tracks'], args['years'], args['type']) scrape_races(races, args['folder_name'], args['file_name'], args['type'])
def parse_args(): parser = ArgParser(allow_config=True) parser.add("--ckpt_path", type=path, required=True) parser.add("--feats_path", type=path, action="append", required=True) parser.add("--feats_vocab", type=path, action="append", required=True) parser.add("--labels_vocab", type=path, required=True) parser.add("--sent_tags", action="store_true", default=False) parser.add("--save_dir", type=path, required=True) parser.add("--batch_size", type=int, default=32) parser.add("--max_length", type=int, default=1e10) parser.add("--gpu", action="store_true", default=False) group = parser.add_group("Model Parameters") group.add("--word_dim", type=int, action="append", required=True) group.add("--hidden_dim", type=int, required=True) args = parser.parse_args() return args