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

[Feature Request] detect unused parameters #323

Closed
terrykong opened this issue Dec 12, 2019 · 3 comments
Closed

[Feature Request] detect unused parameters #323

terrykong opened this issue Dec 12, 2019 · 3 comments
Labels
enhancement Enhanvement request

Comments

@terrykong
Copy link

🚀 Feature Request

Motivation

Is your feature request related to a problem? Please describe.
Hi!

This is a really cool project. I was wondering if there are plans to print unused parameters (maybe as a warning). Say someone declares a config with parameters that aren't all used; say lr_decay isn't used in the code

opt:
  lr: 0.1
  lr_decay: 0.99

As a project gets more complex and more and more parameters get added, it would be nice to print unused parameters at any given time to give the user an idea of what isn't being used. I feel like it would help prevent stale unused parameters. It would also help with silent failures if say, someone's code wasn't handling, say, the lr_decay parameter

Pitch

Describe the solution you'd like

Suppose I had a config that looked like

opt:
  lr: 0.1
  lr_decay: 0.99

It would be nice if I could do the following

@hydra.main(config_path='config.yaml')
def main(cfg):
    cfg.print_unused_params()
    # This would print
    '''
    opt:
      lr: 0.1
      lr_decay: 0.99
    '''
    optimizer = SGD(cfg.opt.lr)
    cfg.print_unused_params()
    # This would print
    '''
    opt:
      lr_decay: 0.99
    '''
    cfg.opt.print_unused_params()
    # This would print
    '''
    lr_decay: 0.99
    '''

main()

Describe alternatives you've considered

Are you willing to open a pull request? (See CONTRIBUTING)

Additional context

Add any other context or screenshots about the feature request here.

@terrykong terrykong added the enhancement Enhanvement request label Dec 12, 2019
@omry
Copy link
Collaborator

omry commented Dec 12, 2019

Hi Terry,
Thanks, happy you are finding Hydra useful!
I would love to hear about the project(s) you are using Hydra for. Are you planning to open source anything that uses it? I can use help from people like you that gets it to spread the word :).
Also, curious how you learned about Hydra.

I like this idea, it actually shows that you get the very subtle point that Hydra composition is allowing you to get the perfect config for each run.
can you post it as a feature request against OmegaConf and not Hydra?
This kind of functionality should can be implemented at the level of OmegaConf.

@terrykong
Copy link
Author

Hi Omry,
Unfortunately I don't have any public projects to share, but I've been trying it out on some projects internally. Hydra aligns with my opinion of how configs should look so I'm thankful this exists.

I think I stumbled upon your blog post on my news feed :)

Sure, I'll post against OmegaConf

@omry
Copy link
Collaborator

omry commented Dec 12, 2019

Great.
Please join the chat if you have any questions.
By the way, do take a look at omry/omegaconf#87

It’s going to very significantly extend OmegaConf.
Adding support for so called structured configs, which are config schemas in which will offer both static and runtime type safety.

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

No branches or pull requests

2 participants