Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Provide a wrapper for get_next_parameter() to update namespace automatically #2437

Closed
ultmaster opened this issue May 15, 2020 · 1 comment
Closed
Assignees
Milestone

Comments

@ultmaster
Copy link
Contributor

ultmaster commented May 15, 2020

Suggest to provide this function in SDK, as in most of the cases, when users receive a parameter, they are going to replace the corresponding argument.

def update_args(args):
    # args is obtained by `parser.parse_args()`
    params = nni.get_next_parameter()
    if not params:
        params = {}
    if params:
        for k, v in params.items():
            assert hasattr(namespace, k), "Args doesn't have received key: %s" % k
            assert type(getattr(namespace, k)) == type(v), "Received key has different type"
            setattr(namespace, k, v)
@ultmaster
Copy link
Contributor Author

Done

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

No branches or pull requests

3 participants