Created
October 8, 2016 11:40
-
-
Save swayson/485ce512f2231e7ef2718f8e224b5d17 to your computer and use it in GitHub Desktop.
Simple boilerplate code, with command line interface, for general data-related tasks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import glob | |
import numpy as np | |
try: | |
import ujson as json | |
except ImportError: | |
import json | |
import argparse | |
argparser = argparse.ArgumentParser( | |
description='Arguments that may be parsed.', epilog="") | |
argparser.add_argument('--input', '-i', type=str, required=True, | |
help='Input file path.') | |
argparser.add_argument('--output', '-o', type=str, required=True, | |
help='Output file path.') | |
argparser.add_argument('--max_samples', '-n', type=int, default=10**6, | |
help='Max samples.') | |
argparser.add_argument('--epochs', type=int, default=5, | |
help='Total number of epochs if applicable.') | |
argparser.add_argument('--n_iter', type=int, default=5, | |
help='Total number of iterations if applicable.') | |
args = argparser.parse_args() | |
def main(args): | |
print(args) | |
if __name__ == "__main__": | |
try: | |
main(args) | |
except Exception: | |
raise | |
else: | |
pass | |
finally: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment