Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line arguments #9

Open
jacobjinkelly opened this issue Jun 21, 2018 · 1 comment
Open

Command line arguments #9

jacobjinkelly opened this issue Jun 21, 2018 · 1 comment

Comments

@jacobjinkelly
Copy link
Owner

Command line arguments should be configured so that results can be reproduced, and one can run new experiments, without having to modify any of the actual codebase. I'm having some issues in doing this with the current project structure (i.e. one has to import a level up) and also with the ugliness of passing parameters from command line args to functions (I haven't been able to find a nice way to do this, i.e. something like f(*args, **kwargs)).

@ColinQiyangLi
Copy link

Some thoughts -

You could convert command line args into a dictionary and then passes it in as **kwargs (e.g., https://stackoverflow.com/questions/12807539/how-do-you-convert-command-line-args-in-python-to-a-dictionary).

You could also directly pass in args into run() in main.py. The run() functions can then take whatever parameters they need from the args. For example, instead of doing

def run():
    name = "train"
    is_ptr = True
    hidden_dim = embedding_dim = 256
    [the rest of your code]

you can just do

def run(args):
    name = args.name
    is_ptr = args.ptr
    hidden_dim = embedding_dim = args.hidden_dim
    [the rest of your code]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants