Created
September 30, 2018 01:07
-
-
Save mrdrozdov/262f7a4740200d50a5dcb478f2212161 to your computer and use it in GitHub Desktop.
argparse snippet
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
import argparse | |
def run(options): | |
print(json.dumps(options.__dict__, sort_keys=True, indent=4)) | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--log', default=None, type=str) | |
parser.add_argument('--seed', default=11, type=int) | |
parser.add_argument('--norun_model', action='store_true') | |
parser.add_argument('--run_random', action='store_true') | |
parser.add_argument('--run_onemax', action='store_true') | |
parser.add_argument('--includes_pos', action='store_true') | |
parser.add_argument('--run_pmi', action='store_true') | |
parser.add_argument('--pmi_data_type', default='txt', choices=('txt', 'ontonotes', 'nli')) | |
parser.add_argument('--pmi_data', default=None, type=str) # If none, then will expect a model to be loaded, or use the evaluation data. | |
parser.add_argument('--pmi_load', default=None, type=str) | |
parser.add_argument('--pmi_save', default=None, type=str) | |
parser.add_argument('--print_summary', action='store_true') | |
parser.add_argument('--show_trees', action='store_true') | |
parser.add_argument('--print_comparison', action='store_true') | |
options = parser.parse_args() | |
options.run_model = not options.norun_model | |
run(options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment