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

MRT User Configuration - Overriding YAML File by Command Line Positional Arguments #86

Open
declmal opened this issue Sep 29, 2021 · 2 comments
Assignees

Comments

@declmal
Copy link
Collaborator

declmal commented Sep 29, 2021

There's a common case that when a user invokes a MRT process, he/she will type in the command line as follows:

python main2.py --yaml-path /path/to/test.yaml

where the yaml file test.yaml is configured beforehand.

when he/she needs to revise some hyper-parameters, one feasible way is to reopen test.yaml and revise the corresponding parameter, which could be tedious.

Another possible way is overriding by optional command line arguments, such as

python main2.py --yaml-path /path/to/test.yaml --softmax-lambd 0.5

where the value of softmax_lambd will be overriden as 0.5.

However, as shown in yacs doc:

Screen Shot 2021-09-29 at 4 37 16 PM

yaml configuration is updated by the interface cfg.merge_from_list, and it is not recommended for configuration along with a command line argument.

So, what could be the best way to implement this command line overriden feature, or is this feature necessary?

Though, one possible solution is to use the common package located in python/mrt/common.

@declmal declmal assigned declmal and wlt-cortex and unassigned wlt-cortex Sep 29, 2021
@declmal
Copy link
Collaborator Author

declmal commented Oct 11, 2021

It seems there are not many opensource choices to override user command in the .yaml file.
One possible way is to use yq, which is a compiled go binary that should be installed beforehand.

suppose the original yaml configuration is written in /path/to/test.yaml as:

AAA:
  BB:
    C: true

The program yq only supports offline overriding, which means that after the user execute:

yq -i e '.AAA.BB.C |= false' /path/to/test.yaml

/path/to/test.yaml will be overriden as:

AAA:
  BB:
    C: false

But this feature is beyond our scope of development.

@declmal
Copy link
Collaborator Author

declmal commented Oct 11, 2021

I did not find any other choices that satisfies the need, so I suppose using argparse would be a feasible choice.

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