-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Conversation
This pull request is now in conflict... :( |
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
Codecov Report
@@ Coverage Diff @@
## master #2846 +/- ##
=======================================
Coverage 90% 90%
=======================================
Files 79 79
Lines 7233 7488 +255
=======================================
+ Hits 6527 6767 +240
- Misses 706 721 +15 |
There was a problem hiding this 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?
try: | ||
from omegaconf import Container, OmegaConf | ||
except ImportError: | ||
OMEGACONF_AVAILABLE = False | ||
else: | ||
OMEGACONF_AVAILABLE = True | ||
|
There was a problem hiding this comment.
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
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
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 🙃