Skip to content

Instantly share code, notes, and snippets.

@swayson
Created October 8, 2016 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swayson/485ce512f2231e7ef2718f8e224b5d17 to your computer and use it in GitHub Desktop.
Save swayson/485ce512f2231e7ef2718f8e224b5d17 to your computer and use it in GitHub Desktop.
Simple boilerplate code, with command line interface, for general data-related tasks.
# -*- 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