-
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
Support hierarchical dict #1152
Support hierarchical dict #1152
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1152 +/- ##
=======================================
+ Coverage 93% 93% +<1%
=======================================
Files 61 61
Lines 2672 2691 +19
=======================================
+ Hits 2472 2491 +19
Misses 200 200 |
very nice! |
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.
LGTM 🚀
Co-Authored-By: Jirka Borovec <[email protected]>
Co-Authored-By: Jirka Borovec <[email protected]>
…m/S-aiueo32/pytorch-lightning into feature/support-hierarchical-dict
* Add support for hierarchical dict * Support nested Namespace * Add docstring * Migrate hparam flattening to each logger * Modify URLs in CHANGELOG * typo * Simplify the conditional branch about Namespace Co-Authored-By: Jirka Borovec <[email protected]> * Update CHANGELOG.md Co-Authored-By: Jirka Borovec <[email protected]> * added examples section to docstring * renamed _dict -> input_dict Co-authored-by: Jirka Borovec <[email protected]>
Is there a reason that |
probably got forgotten, is already done, or not necessary. Did you check, is it necessary to do it @KeAWang ? |
See here: https://docs.wandb.com/library/config
They have thought of it already :) |
Before submitting
What does this PR do?
Fixes #1144.
The main change of this PR is adding the function
_flatten_dict
toLightningLoggerBase
.This function flattens hierarchical dictionaries and nested Namespace objects:
Considering the compatibility to all loggers,
_flatten_dict
is called in thelog_hyperparams
function of each logger class that needs flattening:In other words, this function is not called by the loggers as represented by WanbLogger, which supports hierarchical dictionaries by default, to keep them the hierarchy.
Note1: WanbLogger supports hierarchical dictionaries, but not nested Namespace. It does not raise an error, however, the output yaml file on the UI is displayed as:
Note2: TRAINS also supports hierarchical dictionaries, but the UI destroys the hierarchy as done by
_flatten_dict
. To add support for nested Namespace,TrainsLogger
calls_flatten_dict
.