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

Add support to Tensorboard logger for OmegaConf hparams #2846

Merged
merged 4 commits into from
Aug 7, 2020
Merged

Add support to Tensorboard logger for OmegaConf hparams #2846

merged 4 commits into from
Aug 7, 2020

Conversation

ananthsub
Copy link
Contributor

What does this PR do?

Fixes #2844
We check if we can import omegaconf, and if the hparams are omegaconf instances. if so, we use OmegaConf.merge to preserve the typing, such that saving hparams to yaml actually triggers the OmegaConf branch

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@mergify mergify bot requested a review from a team August 6, 2020 04:09
@romesco
Copy link
Contributor

romesco commented Aug 6, 2020

Check #2519, I think this PR which has been in limbo already fixes #2844 🤙

@mergify
Copy link
Contributor

mergify bot commented Aug 6, 2020

This pull request is now in conflict... :(

@Borda Borda added this to the 0.9.0 milestone Aug 6, 2020
@Borda Borda added the bug Something isn't working label Aug 7, 2020
@mergify mergify bot requested a review from a team August 7, 2020 09:49
ananthsub and others added 3 commits August 7, 2020 11:51
Address #2844

We check if we can import omegaconf, and if the hparams are omegaconf instances. if so, we use OmegaConf.merge to preserve the typing, such that saving hparams to yaml actually triggers the OmegaConf branch
@Borda Borda added ready PRs ready to be merged and removed ready PRs ready to be merged labels Aug 7, 2020
@mergify mergify bot requested a review from a team August 7, 2020 10:57
@Borda Borda added the ready PRs ready to be merged label Aug 7, 2020
@codecov
Copy link

codecov bot commented Aug 7, 2020

Codecov Report

Merging #2846 into master will increase coverage by 0%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #2846    +/-   ##
=======================================
  Coverage      90%     90%            
=======================================
  Files          79      79            
  Lines        7233    7488   +255     
=======================================
+ Hits         6527    6767   +240     
- Misses        706     721    +15     

@williamFalcon williamFalcon merged commit b39f479 into Lightning-AI:master Aug 7, 2020
Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has anyone checked if the other loggers support omegaconf out of the box?

Comment on lines +20 to +26
try:
from omegaconf import Container, OmegaConf
except ImportError:
OMEGACONF_AVAILABLE = False
else:
OMEGACONF_AVAILABLE = True

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wanted to point out (nitpick) that importerror is not the right exception to catch. What you try to do here is check if the package is available, which can be done without trying to import it with just one line with importlib. If the package is available, there can still be an importerror for a different reason. In such a case we really WANT to see the stacktrace and not just ignore it. See also #2266

This actually occurs in many places of PL. Would be great to clean up these code smells and eliminate them right away in the review process of new PRs @PyTorchLightning/core-contributors

@mergify mergify bot requested a review from a team August 8, 2020 00:53
@Borda Borda modified the milestones: 0.9.0, 1.0.0 Aug 20, 2020
@Borda Borda modified the milestones: 1.0.0, 0.9.0 Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tensorboard logger fails to save model OmegaConf hparams
6 participants